From patchwork Fri Apr 27 09:31:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 155404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id BD069B6EF1 for ; Fri, 27 Apr 2012 19:32:25 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SNhXF-0005ZQ-Sz; Fri, 27 Apr 2012 09:32:17 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SNhXD-0005Vt-Jj for kernel-team@lists.ubuntu.com; Fri, 27 Apr 2012 09:32:15 +0000 Received: by mail-pb0-f49.google.com with SMTP id rq13so764954pbb.8 for ; Fri, 27 Apr 2012 02:32:15 -0700 (PDT) Received: by 10.68.134.2 with SMTP id pg2mr15041681pbb.86.1335519135179; Fri, 27 Apr 2012 02:32:15 -0700 (PDT) Received: from localhost ([183.37.200.43]) by mx.google.com with ESMTPS id pg6sm5965348pbb.41.2012.04.27.02.32.13 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Apr 2012 02:32:14 -0700 (PDT) From: ming.lei@canonical.com To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/6] UAS: Free status URB when we can't find the SCSI tag. Date: Fri, 27 Apr 2012 17:31:45 +0800 Message-Id: <1335519112-8372-4-git-send-email-ming.lei@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1335519112-8372-1-git-send-email-ming.lei@canonical.com> References: <1335519112-8372-1-git-send-email-ming.lei@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Sarah Sharp In the UAS status URB completion handler, we need to free the URB, no matter what happens. Fix a bug where we would leak the URB (and its buffer) if we couldn't find a SCSI command that is associated with this status phase. Signed-off-by: Sarah Sharp Cc: Matthew Wilcox Signed-off-by: Sebastian Andrzej Siewior --- drivers/usb/storage/uas.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 28d9b19..9dd4aae 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -246,8 +246,10 @@ static void uas_stat_cmplt(struct urb *urb) cmnd = sdev->current_cmnd; else cmnd = scsi_find_tag(sdev, tag); - if (!cmnd) + if (!cmnd) { + usb_free_urb(urb); return; + } switch (iu->iu_id) { case IU_ID_STATUS: