All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND
@ 2014-10-23 19:10 Tony Battersby
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Battersby @ 2014-10-23 19:10 UTC (permalink / raw)
  To: linux-scsi, James E.J. Bottomley, Jens Axboe; +Cc: linux-kernel

Fix an error path in SCSI_IOCTL_SEND_COMMAND that calls
blk_put_request(rq) on an invalid IS_ERR(rq) pointer.

Fixes: a492f075450f ("block,scsi: fixup blk_get_request dead queue
scenarios")
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---

For inclusion in 3.18 only.

This does not conflict with the other recent fix to sg_scsi_ioctl() from
Jan Kara.

--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -458,7 +458,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
 	rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT);
 	if (IS_ERR(rq)) {
 		err = PTR_ERR(rq);
-		goto error;
+		goto error_free_buffer;
 	}
 	blk_rq_set_block_pc(rq);
 
@@ -532,9 +532,11 @@ out:
 	}
 	
 error:
+	blk_put_request(rq);
+
+error_free_buffer:
 	kfree(buffer);
-	if (rq)
-		blk_put_request(rq);
+
 	return err;
 }
 EXPORT_SYMBOL_GPL(sg_scsi_ioctl);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND
@ 2014-11-10 22:40 Tony Battersby
  2014-11-10 22:43 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Battersby @ 2014-11-10 22:40 UTC (permalink / raw)
  To: linux-scsi, James E.J. Bottomley, Jens Axboe; +Cc: linux-kernel

Fix an error path in SCSI_IOCTL_SEND_COMMAND that calls
blk_put_request(rq) on an invalid IS_ERR(rq) pointer.

Fixes: a492f075450f ("block,scsi: fixup blk_get_request dead queue scenarios")
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---

(resending, since no one picked it up last time)

For inclusion in 3.18 only.  This fixes a problem
introduced in 3.18.

Note: this fixes a *different* problem from Jan Kara's
patch with a similar subject line, which has already
been applied to mainline.

--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -458,7 +458,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
 	rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT);
 	if (IS_ERR(rq)) {
 		err = PTR_ERR(rq);
-		goto error;
+		goto error_free_buffer;
 	}
 	blk_rq_set_block_pc(rq);
 
@@ -531,9 +531,11 @@ out:
 	}
 	
 error:
+	blk_put_request(rq);
+
+error_free_buffer:
 	kfree(buffer);
-	if (rq)
-		blk_put_request(rq);
+
 	return err;
 }
 EXPORT_SYMBOL_GPL(sg_scsi_ioctl);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND
  2014-11-10 22:40 [PATCH] scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND Tony Battersby
@ 2014-11-10 22:43 ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2014-11-10 22:43 UTC (permalink / raw)
  To: Tony Battersby, linux-scsi, James E.J. Bottomley; +Cc: linux-kernel

On 2014-11-10 15:40, Tony Battersby wrote:
> Fix an error path in SCSI_IOCTL_SEND_COMMAND that calls
> blk_put_request(rq) on an invalid IS_ERR(rq) pointer.
>
> Fixes: a492f075450f ("block,scsi: fixup blk_get_request dead queue scenarios")
> Signed-off-by: Tony Battersby <tonyb@cybernetics.com>

Thanks, good catch. Might be an idea to have blk_put_request() do 
warn-and-return check on error pointers being passed in, just in case.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-10 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-10 22:40 [PATCH] scsi: Fix more error handling in SCSI_IOCTL_SEND_COMMAND Tony Battersby
2014-11-10 22:43 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2014-10-23 19:10 Tony Battersby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.