aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/cdns3/cdns3-pci-wrap.c
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2023-05-10 09:42:23 +0200
committerJens Axboe <axboe@kernel.dk>2023-05-19 20:17:10 -0600
commit69baa3a623fd2e58624f24f2f23d46f87b817c93 (patch)
treec12d32ab13e9a1283dcb8701fd3f2065b06255e4 /drivers/usb/cdns3/cdns3-pci-wrap.c
parentc99bff34290f1b994073557b754aff86e4c7b22e (diff)
block: Deny writable memory mapping if block is read-only
User should not be able to write block device if it is read-only at block level (e.g force_ro attribute). This is ensured in the regular fops write operation (blkdev_write_iter) but not when writing via user mapping (mmap), allowing user to actually write a read-only block device via a PROT_WRITE mapping. Example: This can lead to integrity issue of eMMC boot partition (e.g mmcblk0boot0) which is read-only by default. To fix this issue, simply deny shared writable mapping if the block is readonly. Note: Block remains writable if switch to read-only is performed after the initial mapping, but this is expected behavior according to commit a32e236eb93e ("Partially revert "block: fail op_is_write() requests to read-only partitions"")'. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20230510074223.991297-1-loic.poulain@linaro.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-pci-wrap.c')
0 files changed, 0 insertions, 0 deletions