]> www.infradead.org Git - nvme.git/commitdiff
loop: don't clear LO_FLAGS_PARTSCAN on LOOP_SET_STATUS{,64}
authorChristoph Hellwig <hch@lst.de>
Mon, 27 Jan 2025 14:30:44 +0000 (15:30 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jan 2025 16:06:26 +0000 (09:06 -0700)
LOOP_SET_STATUS{,64} can set a lot more flags than it is supposed to
clear (the LOOP_SET_STATUS_CLEARABLE_FLAGS vs
LOOP_SET_STATUS_SETTABLE_FLAGS defines should have been a hint..).

Fix this by only clearing the bits in LOOP_SET_STATUS_CLEARABLE_FLAGS.

Fixes: ae074d07a0e5 ("loop: move updating lo_flag s out of loop_set_status_from_info")
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250127143045.538279-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c

index 1ec7417c7f005141e19274a00221d8f17a75be41..d1f1d6bef2e69608d77cfaff5b796b582fe401bf 100644 (file)
@@ -1281,8 +1281,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
        partscan = !(lo->lo_flags & LO_FLAGS_PARTSCAN) &&
                (info->lo_flags & LO_FLAGS_PARTSCAN);
 
-       lo->lo_flags &= ~(LOOP_SET_STATUS_SETTABLE_FLAGS |
-                         LOOP_SET_STATUS_CLEARABLE_FLAGS);
+       lo->lo_flags &= ~LOOP_SET_STATUS_CLEARABLE_FLAGS;
        lo->lo_flags |= (info->lo_flags & LOOP_SET_STATUS_SETTABLE_FLAGS);
 
        if (size_changed) {