lkml.org 
[lkml]   [2009]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[02/46] SCSI: Fix protection scsi_data_buffer leak
    2.6.31-stable review patch.  If anyone has any objections, please let us know.

    ------------------
    From: Martin K. Petersen <martin.petersen@oracle.com>

    commit b4c2554d40ceac130a8d062eaa8838ed22158c45 upstream.

    We would leak a scsi_data_buffer if the free_list command was of the
    protected variety.

    Reported-by: Boaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: James Bottomley <James.Bottomley@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/scsi/scsi.c | 11 +++++++----
    1 file changed, 7 insertions(+), 4 deletions(-)

    --- a/drivers/scsi/scsi.c
    +++ b/drivers/scsi/scsi.c
    @@ -241,10 +241,7 @@ scsi_host_alloc_command(struct Scsi_Host
    */
    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(str
    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;
    }
    }




    \
     
     \ /
      Last update: 2009-10-16 19:21    [W:3.629 / U:0.164 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site