aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/common.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <stf_xl@wp.pl>2005-11-29 19:16:21 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-29 19:16:21 -0500
commitaaaaaadbe7a663d110814db50fcbe7d320eb4c32 (patch)
tree316bdbd49e3a6ac7a78cad8797d148f79a343d45 /net/atm/common.c
parent49693280262a149e5430d3401e263e464c88334a (diff)
[ATM]: avoid race conditions related to atm_devs list
Use semaphore to protect atm_devs list, as no one need access to it from interrupt context. Avoid race conditions between atm_dev_register(), atm_dev_lookup() and atm_dev_deregister(). Fix double spin_unlock() bug. Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/common.c')
-rw-r--r--net/atm/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/atm/common.c b/net/atm/common.c
index db9318fc6031..9e016f404e14 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -427,12 +427,12 @@ int vcc_connect(struct socket *sock, int itf, short vpi, int vci)
427 dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf); 427 dev = try_then_request_module(atm_dev_lookup(itf), "atm-device-%d", itf);
428 } else { 428 } else {
429 dev = NULL; 429 dev = NULL;
430 spin_lock(&atm_dev_lock); 430 down(&atm_dev_mutex);
431 if (!list_empty(&atm_devs)) { 431 if (!list_empty(&atm_devs)) {
432 dev = list_entry(atm_devs.next, struct atm_dev, dev_list); 432 dev = list_entry(atm_devs.next, struct atm_dev, dev_list);
433 atm_dev_hold(dev); 433 atm_dev_hold(dev);
434 } 434 }
435 spin_unlock(&atm_dev_lock); 435 up(&atm_dev_mutex);
436 } 436 }
437 if (!dev) 437 if (!dev)
438 return -ENODEV; 438 return -ENODEV;