linux-stable/drivers/block
Bart Van Assche 7261d27bcc nbd: Fix signal handling
[ Upstream commit e56d4b633f ]

Both nbd_send_cmd() and nbd_handle_cmd() return either a negative error
number or a positive blk_status_t value. nbd_queue_rq() converts these
return values into a blk_status_t value. There is a bug in the conversion
code: if nbd_send_cmd() returns BLK_STS_RESOURCE, nbd_queue_rq() should
return BLK_STS_RESOURCE instead of BLK_STS_OK. Fix this, move the
conversion code into nbd_handle_cmd() and fix the remaining sparse warnings.

This patch fixes the following sparse warnings:

drivers/block/nbd.c:673:32: warning: incorrect type in return expression (different base types)
drivers/block/nbd.c:673:32:    expected int
drivers/block/nbd.c:673:32:    got restricted blk_status_t [usertype]
drivers/block/nbd.c:714:48: warning: incorrect type in return expression (different base types)
drivers/block/nbd.c:714:48:    expected int
drivers/block/nbd.c:714:48:    got restricted blk_status_t [usertype]
drivers/block/nbd.c:1120:21: warning: incorrect type in assignment (different base types)
drivers/block/nbd.c:1120:21:    expected int [assigned] ret
drivers/block/nbd.c:1120:21:    got restricted blk_status_t [usertype]
drivers/block/nbd.c:1125:16: warning: incorrect type in return expression (different base types)
drivers/block/nbd.c:1125:16:    expected restricted blk_status_t
drivers/block/nbd.c:1125:16:    got int [assigned] ret

Cc: Christoph Hellwig <hch@lst.de>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Yu Kuai <yukuai3@huawei.com>
Cc: Markus Pargmann <mpa@pengutronix.de>
Fixes: fc17b6534e ("blk-mq: switch ->queue_rq return value to blk_status_t")
Cc: stable@vger.kernel.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240510202313.25209-6-bvanassche@acm.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-27 13:49:14 +02:00
..
aoe aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts 2024-03-26 18:19:19 -04:00
drbd drbd: swap bvec_set_page len and offset 2023-09-06 07:33:03 -06:00
mtip32xx block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
null_blk null_blk: Print correct max open zones limit in null_init_zoned_dev() 2024-06-21 14:38:40 +02:00
rnbd block/rnbd-srv: Check for unlikely string overflow 2024-02-05 20:14:22 +00:00
xen-blkback block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
zram zram: take device and not only bvec offset into account 2023-08-05 16:13:15 -06:00
Kconfig block: ublk: switch to ioctl command encoding 2023-04-18 20:13:30 -06:00
Makefile Revert "pktcdvd: remove driver." 2023-01-04 14:44:13 -07:00
amiflop.c amiflop: don't call fsync_bdev in FDFMTBEG 2023-08-21 14:35:31 +02:00
ataflop.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
brd.c brd: use cond_resched instead of cond_resched_rcu 2023-06-14 11:13:07 -06:00
floppy.c floppy: call disk_force_media_change when changing the format 2023-08-21 14:35:31 +02:00
loop.c loop: fix the the direct I/O support check when used on top of block devices 2024-01-25 15:36:00 -08:00
n64cart.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
nbd.c nbd: Fix signal handling 2024-06-27 13:49:14 +02:00
pktcdvd.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
ps3disk.c block: remove blk_cleanup_disk 2022-06-28 06:33:15 -06:00
ps3vram.c ps3vram: remove bio splitting 2023-01-29 15:18:35 -07:00
rbd.c rbd: don't move requests to the running list on errors 2024-01-31 16:19:06 -08:00
rbd_types.h
sunvdc.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00
swim.c swim: fix a missing FMODE_ -> BLK_OPEN_ conversion in floppy_open 2023-06-20 07:16:04 -06:00
swim3.c swim3: mark swim3_init() static 2023-08-10 08:32:59 -06:00
swim_asm.S
ublk_drv.c ublk: move ublk_cancel_dev() out of ub->mutex 2024-03-06 14:48:34 +00:00
virtio_blk.c virtio-blk: Ensure no requests in virtqueues before deleting vqs. 2024-03-01 13:34:56 +01:00
xen-blkfront.c for-6.5/block-2023-06-23 2023-06-26 12:47:20 -07:00
z2ram.c block: replace fmode_t with a block-specific type for block open flags 2023-06-12 08:04:05 -06:00