When blk_end_request() returns 'false' in scsi_end_request the request is invalid after blk_end_request_all(). So we must not return the then stale request pointer. Doing so will result in a potential double completion. And we should be calling scsi_release_buffers() before blk_end_request_all(). Cc: Mike Christie <michaelc@xxxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Hannes Reinecke <hare@xxxxxxx> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index c31187d..8dba66b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -581,9 +581,11 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, */ if (blk_end_request(req, error, bytes)) { /* kill remainder if no retrys */ - if (error && scsi_noretry_cmd(cmd)) + if (error && scsi_noretry_cmd(cmd)) { + scsi_release_buffers(cmd); blk_end_request_all(req, error); - else { + cmd = NULL; + } else { if (requeue) { /* * Bleah. Leftovers again. Stick the -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html