]> git.baikalelectronics.ru Git - kernel.git/commit
loop: Set correct device size when using LOOP_CONFIGURE
authorMartijn Coenen <maco@android.com>
Tue, 25 Aug 2020 07:18:29 +0000 (09:18 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 26 Aug 2020 15:30:31 +0000 (09:30 -0600)
commit1f18f7f48c003a2d09a1fe5b4469ffa16e7e8307
treebbf59ef6b7b05d37c3b7fc25c14e6a8715358882
parentdc658c5efd99d3ce8dd60a67a0e3ede2f7f01f38
loop: Set correct device size when using LOOP_CONFIGURE

The device size calculation was done before processing the loop
configuration, which meant that the we set the size on the underlying
block device incorrectly in case lo_offset/lo_sizelimit were set in the
configuration. Delay computing the size until we've setup the device
parameters correctly.

Fixes: c3815145eace("loop: Add LOOP_CONFIGURE ioctl")
Reported-by: Lennart Poettering <mzxreary@0pointer.de>
Tested-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Martijn Coenen <maco@android.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c