Commit 55872c5a authored by Jens Axboe's avatar Jens Axboe

bsg: fix potential error pointer dereference

Dan writes:

block/bsg.c:327 bsg_map_hdr() error: 'next_rq' dereferencing possible
ERR_PTR().

Fix this by setting next_rq to NULL, for the case where it can be
!= NULL but an error pointer.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent a492f075
...@@ -287,6 +287,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, ...@@ -287,6 +287,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
next_rq = blk_get_request(q, READ, GFP_KERNEL); next_rq = blk_get_request(q, READ, GFP_KERNEL);
if (IS_ERR(next_rq)) { if (IS_ERR(next_rq)) {
ret = PTR_ERR(next_rq); ret = PTR_ERR(next_rq);
next_rq = NULL;
goto out; goto out;
} }
rq->next_rq = next_rq; rq->next_rq = next_rq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment