1
0
Fork 0

[SCSI] don't reference freed command in scsi_prep_return

Patch

commit 0479633686
Author: Christoph Hellwig <hch@infradead.org>
Date:   Thu Feb 20 14:20:55 2014 -0800

    [SCSI] do not manipulate device reference counts in scsi_get/put_command

Introduced a use after free:I in the kill case of scsi_prep_return we have to
release our device reference, but we do this trying to reference the just
freed command.  Use the local sdev pointer instead.

Fixes: 0479633686
Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
hifive-unleashed-5.1
Christoph Hellwig 2014-04-15 12:24:56 +02:00 committed by James Bottomley
parent 5e012aad85
commit 68c03d9193
1 changed files with 1 additions and 1 deletions

View File

@ -1274,7 +1274,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret)
struct scsi_cmnd *cmd = req->special;
scsi_release_buffers(cmd);
scsi_put_command(cmd);
put_device(&cmd->device->sdev_gendev);
put_device(&sdev->sdev_gendev);
req->special = NULL;
}
break;