]> git.karo-electronics.de Git - karo-tx-linux.git/commit
firewire: fw-sbp2: fix races
authorJay Fenlason <fenlason@redhat.com>
Mon, 27 Oct 2008 22:29:32 +0000 (23:29 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 7 Nov 2008 03:05:45 +0000 (19:05 -0800)
commitbaae4f5fd7a75bdfa70d374b738963053df2bcaa
tree3ddc556189259fbd559655837c93215c832b2082
parent25a5d6623213609e2569c9fc3c64136bbb811946
firewire: fw-sbp2: fix races

Same as commit cd1f70fdb4823c97328a1f151f328eb36fafd579 upstream

1: There is a small race between queue_delayed_work() and its
   corresponding kref_get().  Do the kref_get first, and _put it again
   if the queue_delayed_work() failed, so there is no chance of the
   kref going to zero while the work is scheduled.
2: An SBP2_LOGOUT_REQUEST could be sent out with a login_id full of
   garbage.  Initialize it to an invalid value so we can tell if we
   ever got a valid login_id.
3: The node ID and generation may have changed but the new values may
   not yet have been recorded in lu and tgt when the final logout is
   attempted.  Use the latest values from the device in
   sbp2_release_target().

Signed-off-by: Jay Fenlason <fenlason@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/firewire/fw-sbp2.c