Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757113AbYFMOWR (ORCPT ); Fri, 13 Jun 2008 10:22:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754586AbYFMOWE (ORCPT ); Fri, 13 Jun 2008 10:22:04 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55220 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753978AbYFMOWC (ORCPT ); Fri, 13 Jun 2008 10:22:02 -0400 Subject: Re: [PATCH] firewire: fill_bus_reset_event needs lock protection From: Kristian =?ISO-8859-1?Q?H=F8gsberg?= To: Stefan Richter Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset=utf8 Date: Fri, 13 Jun 2008 10:21:38 -0400 Message-Id: <1213366898.25956.0.camel@gaara.bos.redhat.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.0 (2.22.0-4.fc9) Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1031 Lines: 27 On Fri, 2008-06-06 at 22:11 +0200, Stefan Richter wrote: > Callers of fill_bus_reset_event() have to take card->lock. Otherwise > access to node data may oops if node removal is in progress. > > A lockless alternative would be > > - event->local_node_id = card->local_node->node_id; > + tmp = fw_node_get(card->local_node); > + event->local_node_id = tmp->node_id; > + fw_node_put(tmp); > > and ditto with the other node pointers which fill_bus_reset_event() > accesses. But I went the locked route because one of the two callers > already holds the lock. As a bonus, we don't need the memory barrier > anymore because device->generation and device->node_id are written in > a card->lock protected section. Looks good to me. Signed-off-by: Kristian Høgsberg -- 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/