public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* srp_transport: Fix atttribute registration race
@ 2011-10-21 16:57 Bart Van Assche
       [not found] ` <201110211857.23622.bvanassche-HInyCGIudOg@public.gmane.org>
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Van Assche @ 2011-10-21 16:57 UTC (permalink / raw)
  To: linux-scsi-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Fujita Tomonori, Brian King,
	David Dillow, Roland Dreier

Register transport attributes after the attribute array has been
set up instead of before. The current code is racy because there
is no guarantee that the CPU examining the attribute container
will see all values written to the container.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: FUJITA Tomonori <fujita.tomonori-Zyj7fXuS5i5L9jVzuh4AOg@public.gmane.org>
Cc: Brian King <brking-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: <stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/scsi/scsi_transport_srp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index 21a045e..07c4394 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -324,13 +324,14 @@ srp_attach_transport(struct srp_function_template *ft)
 	i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
 	i->rport_attr_cont.ac.class = &srp_rport_class.class;
 	i->rport_attr_cont.ac.match = srp_rport_match;
-	transport_container_register(&i->rport_attr_cont);
 
 	count = 0;
 	SETUP_RPORT_ATTRIBUTE_RD(port_id);
 	SETUP_RPORT_ATTRIBUTE_RD(roles);
 	i->rport_attrs[count] = NULL;
 
+	transport_container_register(&i->rport_attr_cont);
+
 	i->f = ft;
 
 	return &i->t;
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-11-15  7:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 16:57 srp_transport: Fix atttribute registration race Bart Van Assche
     [not found] ` <201110211857.23622.bvanassche-HInyCGIudOg@public.gmane.org>
2011-10-31  9:33   ` James Bottomley
2011-11-01 18:47     ` Bart Van Assche
     [not found]       ` <CAO+b5-oxshsL7Dm7vhv4zC8m0P4dG3iNzxU9sdbi5cBkAnTpMQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-13  4:18         ` Bill Boas
2011-11-13 21:55           ` Dave Dillow
2011-11-13 22:46             ` Paul Grun
     [not found]             ` <20111113215523.GA6117-1Heg1YXhbW8@public.gmane.org>
2011-11-14 21:43               ` Or Gerlitz
2011-11-14 22:17                 ` Dave Dillow
     [not found]                 ` <CAJZOPZ+N2OLLHdKAFk=xkXGzFEdisaGsDBf6ra56pcT6zO_8qQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-15  7:04                   ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox