diff options
author | Jens Axboe <axboe@fb.com> | 2014-08-28 23:05:40 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2014-08-29 16:34:14 +0200 |
commit | 55872c5a3c01f0fe7b5298d19e24e237f5b5ff06 (patch) | |
tree | e1747d5c4a677f2266388eccf4f03c772a786345 /block/bsg.c | |
parent | block,scsi: fixup blk_get_request dead queue scenarios (diff) | |
download | linux-55872c5a3c01f0fe7b5298d19e24e237f5b5ff06.tar.xz linux-55872c5a3c01f0fe7b5298d19e24e237f5b5ff06.zip |
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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/bsg.c')
-rw-r--r-- | block/bsg.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/block/bsg.c b/block/bsg.c index 73c78fd12cc1..276e869e686c 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -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); if (IS_ERR(next_rq)) { ret = PTR_ERR(next_rq); + next_rq = NULL; goto out; } rq->next_rq = next_rq; |