aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-02-10 04:43:56 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:21 -0500
commitd3b7f69de2b92e4b6057d81e6c52f629a8663368 (patch)
treead2ba9ef0cf024b3341b5eaf67929ee82b71701b /arch/um/drivers
parent190c3e456325942a17785332fe15b68eeb3775ca (diff)
[PATCH] uml: add locking to network transport registration
The registration of host network transports needed some locking. The transport list itself is locked, but calls to the registration routines are not. This is compensated for by checking that a transport structure is not yet on any list. I also took the opportunity to const all fields in the transport structure except the list, which obviously can be modified. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r--arch/um/drivers/net_kern.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 07e839e387db..b10154cc46b6 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -498,10 +498,8 @@ struct eth_init {
498 int index; 498 int index;
499}; 499};
500 500
501/* Filled in at boot time. Will need locking if the transports become 501static DEFINE_SPINLOCK(transports_lock);
502 * modular. 502static LIST_HEAD(transports);
503 */
504struct list_head transports = LIST_HEAD_INIT(transports);
505 503
506/* Filled in during early boot */ 504/* Filled in during early boot */
507struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line); 505struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line);
@@ -540,7 +538,10 @@ void register_transport(struct transport *new)
540 char *mac = NULL; 538 char *mac = NULL;
541 int match; 539 int match;
542 540
541 spin_lock(&transports_lock);
542 BUG_ON(!list_empty(&new->list));
543 list_add(&new->list, &transports); 543 list_add(&new->list, &transports);
544 spin_unlock(&transports_lock);
544 545
545 list_for_each_safe(ele, next, &eth_cmd_line){ 546 list_for_each_safe(ele, next, &eth_cmd_line){
546 eth = list_entry(ele, struct eth_init, list); 547 eth = list_entry(ele, struct eth_init, list);