]> git.baikalelectronics.ru Git - kernel.git/commit
ieee1394: sbp2: safer initialization of status fifo
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 23 Jul 2006 20:16:00 +0000 (22:16 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Sun, 17 Sep 2006 17:29:22 +0000 (19:29 +0200)
commit0cd44a3f24d999b6baf8ad4ad9f4ebf64d650469
treeb7135fa6db9b39b3f351a6030df0131fb0514163
parent16773bb0fdf2b3218ae44e7740ef22ef5c41ecd7
ieee1394: sbp2: safer initialization of status fifo

Sbp2's copy of the status fifo was cleared when management ORBs or new
command ORBs were prepared.  The latter had potential for a race
condition if the block layer's soft IRQ and the 1394 LLD's interrupt
handler ran on different CPUs.  It would also yield wrong status if a
command was completed with non-zero completion status before other
commands that had zero completion status, and no new command was
enqueued in the meantime.

Now, the status buffer is cleared right before it is written.  Thus it
ends up in the following simpler and safer access pattern:
 - sbp2_alloc_device: allocates and implicitly clears once,
 - sbp2_handle_status_write: clears, writes, and reads,
 - sbp2_query_logins, sbp2_login_device, sbp2_reconnect_device: read.
The latter three do not race with sbp2_handle_status_write because of
how the protocol works.

As a tiny optimization, the first two quadlets of the status never need
to be cleared.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/ieee1394/sbp2.c