Skip to content

Commit

Permalink
bsg: fix potential error pointer dereference
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Aug 29, 2014
1 parent a492f07 commit 55872c5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 55872c5

Please sign in to comment.