Messages in this thread | | | Subject | Re: [PATCH] firewire: fill_bus_reset_event needs lock protection | From | Kristian Høgsberg <> | Date | Fri, 13 Jun 2008 10:21:38 -0400 |
| |
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 <krh@redhat.com>
-- 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/
| |