Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757420Ab2BAVy0 (ORCPT ); Wed, 1 Feb 2012 16:54:26 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48105 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756985Ab2BAVIF (ORCPT ); Wed, 1 Feb 2012 16:08:05 -0500 X-Sasl-enc: gmFwnUVnzoPFF49tSvO6ASdYdvNMC/oOJerOr9+q6WRt 1328130484 X-Mailbox-Line: From gregkh@clark.kroah.org Wed Feb 1 12:15:32 2012 Message-Id: <20120201201532.233253910@clark.kroah.org> User-Agent: quilt/0.51-14.1 Date: Wed, 01 Feb 2012 12:14:16 -0800 From: Greg KH To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Oliver Neukum Subject: [14/20] USB: cdc-wdm: updating desc->length must be protected by spin_lock In-Reply-To: <20120201210055.GA25374@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1126 Lines: 37 2.6.32-longterm review patch. If anyone has any objections, please let me know. ------------------ From: Bjørn Mork commit c428b70c1e115c5649707a602742e34130d19428 upstream. wdm_in_callback() will also touch this field, so we cannot change it without locking Signed-off-by: Bjørn Mork Acked-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/cdc-wdm.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -458,7 +458,9 @@ retry: for (i = 0; i < desc->length - cntr; i++) desc->ubuf[i] = desc->ubuf[i + cntr]; + spin_lock_irq(&desc->iuspin); desc->length -= cntr; + spin_unlock_irq(&desc->iuspin); /* in case we had outstanding data */ if (!desc->length) clear_bit(WDM_READ, &desc->flags); -- 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/