]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
uas: Clear cmdinfo on command queue-ing
authorHans de Goede <hdegoede@redhat.com>
Thu, 14 Nov 2013 10:06:13 +0000 (11:06 +0100)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Tue, 4 Mar 2014 23:38:24 +0000 (15:38 -0800)
The scsi error handling path re-uses previously queued up (and errored-out)
cmds. If such a re-used cmd had a data-phase then cmdinfo will have
data_in_urb / data_out_urb still set to the free-ed urbs from the errored-out
cmd, and they will get free-ed a second time when the error handling cmd
completes, corrupting the kernel heap.

Clearing cmdinfo on command queue-ing fixes this, and seems like a good idea
in general.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
drivers/usb/storage/uas.c

index d81d041842f41901ca3022a79ccd631488651d51..fceffccc1be1673230a6b6b34a21bd7fabe0585b 100644 (file)
@@ -684,6 +684,8 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
                return SCSI_MLQUEUE_DEVICE_BUSY;
        }
 
+       memset(cmdinfo, 0, sizeof(*cmdinfo));
+
        if (blk_rq_tagged(cmnd->request)) {
                cmdinfo->stream = cmnd->request->tag + 2;
        } else {