mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[SCSI] Fix protection scsi_data_buffer leak
We would leak a scsi_data_buffer if the free_list command was of the protected variety. Reported-by: Boaz Harrosh <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> Cc: Stable Tree <[email protected]> Signed-off-by: James Bottomley <[email protected]>
This commit is contained in:
parent
35e1a5d90b
commit
b4c2554d40
1 changed files with 7 additions and 4 deletions
|
|
@ -241,10 +241,7 @@ scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask)
|
|||
*/
|
||||
struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
|
||||
{
|
||||
struct scsi_cmnd *cmd;
|
||||
unsigned char *buf;
|
||||
|
||||
cmd = scsi_host_alloc_command(shost, gfp_mask);
|
||||
struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask);
|
||||
|
||||
if (unlikely(!cmd)) {
|
||||
unsigned long flags;
|
||||
|
|
@ -258,9 +255,15 @@ struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask)
|
|||
spin_unlock_irqrestore(&shost->free_list_lock, flags);
|
||||
|
||||
if (cmd) {
|
||||
void *buf, *prot;
|
||||
|
||||
buf = cmd->sense_buffer;
|
||||
prot = cmd->prot_sdb;
|
||||
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
|
||||
cmd->sense_buffer = buf;
|
||||
cmd->prot_sdb = prot;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue