Re: [PATCH] firewire: fill_bus_reset_event needs lock protection

From: Kristian Høgsberg
Date: Fri Jun 13 2008 - 10:22:17 EST


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@xxxxxxxxxx>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/