Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760130AbZJMPDj (ORCPT ); Tue, 13 Oct 2009 11:03:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757970AbZJMPDi (ORCPT ); Tue, 13 Oct 2009 11:03:38 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:57573 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbZJMPDg (ORCPT ); Tue, 13 Oct 2009 11:03:36 -0400 Date: Tue, 13 Oct 2009 08:02:35 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Alan Cox cc: Nix , Paul Fulghum , "Justin P. Mattock" , "Rafael J. Wysocki" , Linux Kernel Mailing List , Kernel Testers List , Boyan , Dmitry Torokhov , Ed Tomlinson , =?ISO-8859-15?Q?Fr=E9d=E9ric_L=2E_W=2E_Meunier?= , OGAWA Hirofumi Subject: Re: [Bug #14388] keyboard under X with 2.6.31 In-Reply-To: Message-ID: References: <56acieJJ2fF.A.nEB.Hzl0KB@chimera> <87ljjgfcbu.fsf@spindle.srvr.nix> <20091013113232.384b2432@lxorguk.ukuu.org.uk> User-Agent: Alpine 2.01 (LFD 1184 2008-12-16) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1163 Lines: 29 On Tue, 13 Oct 2009, Linus Torvalds wrote: > > - whoever is _reading_ the buffer, and due to memory ordering may see the > update to the buffer length _before_ it actually sees the data itself. > That spinlock does all the memory ordering too. Hmm. This one looks like it's ok, because whenever we commit it, we do take the spinlock, so '->commit' is protected for the reader side. > - scrambling the data order with two writers is certainly less annoying > than potentially screwing up ->used entirely, and having the memcpy's > overflow the buffer. Both writers may have decided that there is enough > room for each one - but that does not mean that there is enough room > for _both_. .. but this one is still true. Anybody who doesn't lock writers at a higher level could easily end up causing some really subtle memory corruption. But maybe all users really are safe. Linus -- 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/