Skip to content

Commit 7729185

Browse files
tititiou36axboe
authored andcommitted
nbd: Fix error handling
'blk_mq_alloc_request()' returns an error pointer in case of error, not NULL. So test it with IS_ERR. Fixes: fd8383f ("nbd: convert to blkmq") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent bc33b0c commit 7729185

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/block/nbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
599599
return -EINVAL;
600600

601601
sreq = blk_mq_alloc_request(bdev_get_queue(bdev), WRITE, 0);
602-
if (!sreq)
602+
if (IS_ERR(sreq))
603603
return -ENOMEM;
604604

605605
mutex_unlock(&nbd->tx_lock);

0 commit comments

Comments
 (0)