From patchwork Thu Sep 18 14:31:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 37589 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E8D42054E for ; Thu, 18 Sep 2014 14:31:47 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf320494lbg.1 for ; Thu, 18 Sep 2014 07:31:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=do1BxFx71hvhaVqLZYj5t52u6cUtaTjiOMOAndkfRWo=; b=TsULjUMgyE7avRyf+xb7SMR9kiT97p78JLWy3Z/YpwCe0lSQ/FAxOR6UEW9ZFICmHF zGzQIRa10iaL/7QHnfuWBPvnZVgEYZAgDJi9gWDHdeUGKhpGXiOUcKzlP2wmzBOSokOe 2QH1myM87+xQ3ugB/NXyplockd4+GOqfLm3Rt2k4wG15cx4iCYARqi9K1486kFaqptC8 z6ZPV8L22+Uv1kMya4MG1o+tm+vr2GCuMcIUHiPMyNumqDt/0YpvYeVCMd3PjqpYMr3y hbm5G4MEX3V3/35A/gJvGO6KMa2TsJJyrbR13bCEIWeuwplIip7aVyka+ziocDgIDofC Eglg== X-Gm-Message-State: ALoCoQlpmuEG04lyBuwyE1FsixlVjPA+ItMcBDEbcOE0CyJ2ah9e1HUYHjzlghA47NTRcJKgkM0u X-Received: by 10.152.1.6 with SMTP id 6mr877871lai.3.1411050704540; Thu, 18 Sep 2014 07:31:44 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.76 with SMTP id le12ls223611lac.34.gmail; Thu, 18 Sep 2014 07:31:44 -0700 (PDT) X-Received: by 10.152.25.170 with SMTP id d10mr19822lag.37.1411050704405; Thu, 18 Sep 2014 07:31:44 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id am7si33038378lac.74.2014.09.18.07.31.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Sep 2014 07:31:44 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id ty20so1253652lab.23 for ; Thu, 18 Sep 2014 07:31:44 -0700 (PDT) X-Received: by 10.152.246.6 with SMTP id xs6mr183972lac.56.1411050704260; Thu, 18 Sep 2014 07:31:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp767220lbb; Thu, 18 Sep 2014 07:31:43 -0700 (PDT) X-Received: by 10.70.42.7 with SMTP id j7mr5725412pdl.9.1411050702784; Thu, 18 Sep 2014 07:31:42 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si40162888pdm.56.2014.09.18.07.31.42 for ; Thu, 18 Sep 2014 07:31:42 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756037AbaIRObk (ORCPT + 2 others); Thu, 18 Sep 2014 10:31:40 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:55517 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755694AbaIRObj (ORCPT ); Thu, 18 Sep 2014 10:31:39 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8IEVYI1010075; Thu, 18 Sep 2014 09:31:34 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8IEVY2E013107; Thu, 18 Sep 2014 09:31:34 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 18 Sep 2014 09:31:34 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8IEVXKj016801; Thu, 18 Sep 2014 09:31:34 -0500 From: Felipe Balbi To: Greg KH CC: Linux USB Mailing List , Felipe Balbi , Li Jun Subject: [PATCH] Revert "usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup" Date: Thu, 18 Sep 2014 09:31:32 -0500 Message-ID: <1411050692-25763-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.243.g30d45f7 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This reverts commit f2267089ea17fa97b796b1b4247e3f8957655df3. That commit causes more problem than fixes. Firstly, kfree() should be called after usb_ep_dequeue() and secondly, the way things are, we will try to dequeue a request that has already completed much more frequently than one which is pending. Cc: Li Jun Signed-off-by: Felipe Balbi --- Greg, can you still apply this for v3.17 final ? Please take it as a patch directly so we avoid a pull request for a single patch. If you prefer a pull, let me know. Li Jun, a proper change to guarantee there will be no pending requests when we unload a composite gadget driver needs to be more involved. I'll send patches (which I plan on adding to v3.19 only) shortly. Please give me your Tested-by once I send such patches. drivers/usb/gadget/composite.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 6935a82..f801519 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1956,7 +1956,6 @@ void composite_dev_cleanup(struct usb_composite_dev *cdev) } if (cdev->req) { kfree(cdev->req->buf); - usb_ep_dequeue(cdev->gadget->ep0, cdev->req); usb_ep_free_request(cdev->gadget->ep0, cdev->req); } cdev->next_string_id = 0;