Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933745Ab1C3VTR (ORCPT ); Wed, 30 Mar 2011 17:19:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:44838 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965195Ab1C3VJn (ORCPT ); Wed, 30 Mar 2011 17:09:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.63,270,1299484800"; d="scan'208";a="727133966" From: Andi Kleen References: <20110330203.501921634@firstfloor.org> In-Reply-To: <20110330203.501921634@firstfloor.org> To: peter@holik.at, t.sailer@alumni.ethz.ch, gregkh@suse.de, ak@linux.intel.com, linux-kernel@vger.kernel.org, stable@kernel.org, tim.bird@am.sony.com Subject: [PATCH] [235/275] USB: uss720 fixup refcount position Message-Id: <20110330210801.236473E1A05@tassilo.jf.intel.com> Date: Wed, 30 Mar 2011 14:08:01 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1831 Lines: 47 2.6.35-longterm review patch. If anyone has any objections, please let me know. ------------------ From: Peter Holik commit adaa3c6342b249548ea830fe8e02aa5b45be8688 upstream. My testprog do a lot of bitbang - after hours i got following warning and my machine lockups: WARNING: at /build/buildd/linux-2.6.38/lib/kref.c:34 After debugging uss720 driver i discovered that the completion callback was called before usb_submit_urb returns. The callback frees the request structure that is krefed on return by usb_submit_urb. Signed-off-by: Peter Holik Acked-by: Thomas Sailer Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- drivers/usb/misc/uss720.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) Index: linux-2.6.35.y/drivers/usb/misc/uss720.c =================================================================== --- linux-2.6.35.y.orig/drivers/usb/misc/uss720.c 2011-03-29 22:50:20.427735723 -0700 +++ linux-2.6.35.y/drivers/usb/misc/uss720.c 2011-03-29 23:53:41.596473326 -0700 @@ -177,12 +177,11 @@ spin_lock_irqsave(&priv->asynclock, flags); list_add_tail(&rq->asynclist, &priv->asynclist); spin_unlock_irqrestore(&priv->asynclock, flags); + kref_get(&rq->ref_count); ret = usb_submit_urb(rq->urb, mem_flags); - if (!ret) { - kref_get(&rq->ref_count); + if (!ret) return rq; - } - kref_put(&rq->ref_count, destroy_async); + destroy_async(&rq->ref_count); err("submit_async_request submit_urb failed with %d", ret); return NULL; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/