lkml.org 
[lkml]   [2008]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] firewire: fill_bus_reset_event needs lock protection
From
Date
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/

\
 
 \ /
  Last update: 2008-06-13 16:25    [W:0.082 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site