Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932118AbWCIXYQ (ORCPT ); Thu, 9 Mar 2006 18:24:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932131AbWCIXYQ (ORCPT ); Thu, 9 Mar 2006 18:24:16 -0500 Received: from sj-iport-3-in.cisco.com ([171.71.176.72]:20540 "EHLO sj-iport-3.cisco.com") by vger.kernel.org with ESMTP id S932118AbWCIXYP (ORCPT ); Thu, 9 Mar 2006 18:24:15 -0500 X-IronPort-AV: i="4.02,180,1139212800"; d="scan'208"; a="414158496:sNHT41594512" To: "Bryan O'Sullivan" Cc: rolandd@cisco.com, gregkh@suse.de, akpm@osdl.org, davem@davemloft.net, linux-kernel@vger.kernel.org, openib-general@openib.org Subject: Re: [PATCH 9 of 20] ipath - char devices for diagnostics and lightweight subnet management X-Message-Flag: Warning: May contain useful information References: From: Roland Dreier Date: Thu, 09 Mar 2006 15:24:13 -0800 In-Reply-To: (Bryan O'Sullivan's message of "Thu, 9 Mar 2006 08:47:02 -0800") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.18 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-OriginalArrivalTime: 09 Mar 2006 23:24:13.0853 (UTC) FILETIME=[93CC34D0:01C643D0] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 885 Lines: 25 > +static int ipath_sma_open(struct inode *in, struct file *fp) > +{ > + int s; > + > + if (ipath_sma_alive) { > + ipath_dbg("SMA already running (pid %u), failing\n", > + ipath_sma_alive); > + return -EBUSY; > + } > + > + for (s = 0; s < atomic_read(&ipath_max); s++) { > + struct ipath_devdata *dd = ipath_lookup(s); > + /* we need at least one infinipath device to be initialized. */ > + if (dd && dd->ipath_flags & IPATH_INITTED) { > + ipath_sma_alive = current->pid; It seems there's a window here where two processes can both pass the if (ipath_sma_alive) test and then proceed to step on each other. - R. - 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/