diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-18 05:39:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-18 05:39:39 -0400 |
commit | 49997d75152b3d23c53b0fa730599f2f74c92c65 (patch) | |
tree | 46e93126170d02cfec9505172e545732c1b69656 /drivers/net/wan | |
parent | a0c80b80e0fb48129e4e9d6a9ede914f9ff1850d (diff) | |
parent | 5b664cb235e97afbf34db9c4d77f08ebd725335e (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
Documentation/powerpc/booting-without-of.txt
drivers/atm/Makefile
drivers/net/fs_enet/fs_enet-main.c
drivers/pci/pci-acpi.c
net/8021q/vlan.c
net/iucv/iucv.c
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/cosa.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index b0fce1387eaf..5827324e9d9f 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <linux/spinlock.h> | 92 | #include <linux/spinlock.h> |
93 | #include <linux/mutex.h> | 93 | #include <linux/mutex.h> |
94 | #include <linux/device.h> | 94 | #include <linux/device.h> |
95 | #include <linux/smp_lock.h> | ||
95 | 96 | ||
96 | #undef COSA_SLOW_IO /* for testing purposes only */ | 97 | #undef COSA_SLOW_IO /* for testing purposes only */ |
97 | 98 | ||
@@ -970,15 +971,21 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
970 | struct channel_data *chan; | 971 | struct channel_data *chan; |
971 | unsigned long flags; | 972 | unsigned long flags; |
972 | int n; | 973 | int n; |
974 | int ret = 0; | ||
973 | 975 | ||
976 | lock_kernel(); | ||
974 | if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) | 977 | if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) |
975 | >= nr_cards) | 978 | >= nr_cards) { |
976 | return -ENODEV; | 979 | ret = -ENODEV; |
980 | goto out; | ||
981 | } | ||
977 | cosa = cosa_cards+n; | 982 | cosa = cosa_cards+n; |
978 | 983 | ||
979 | if ((n=iminor(file->f_path.dentry->d_inode) | 984 | if ((n=iminor(file->f_path.dentry->d_inode) |
980 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) | 985 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) { |
981 | return -ENODEV; | 986 | ret = -ENODEV; |
987 | goto out; | ||
988 | } | ||
982 | chan = cosa->chan + n; | 989 | chan = cosa->chan + n; |
983 | 990 | ||
984 | file->private_data = chan; | 991 | file->private_data = chan; |
@@ -987,7 +994,8 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
987 | 994 | ||
988 | if (chan->usage < 0) { /* in netdev mode */ | 995 | if (chan->usage < 0) { /* in netdev mode */ |
989 | spin_unlock_irqrestore(&cosa->lock, flags); | 996 | spin_unlock_irqrestore(&cosa->lock, flags); |
990 | return -EBUSY; | 997 | ret = -EBUSY; |
998 | goto out; | ||
991 | } | 999 | } |
992 | cosa->usage++; | 1000 | cosa->usage++; |
993 | chan->usage++; | 1001 | chan->usage++; |
@@ -996,7 +1004,9 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
996 | chan->setup_rx = chrdev_setup_rx; | 1004 | chan->setup_rx = chrdev_setup_rx; |
997 | chan->rx_done = chrdev_rx_done; | 1005 | chan->rx_done = chrdev_rx_done; |
998 | spin_unlock_irqrestore(&cosa->lock, flags); | 1006 | spin_unlock_irqrestore(&cosa->lock, flags); |
999 | return 0; | 1007 | out: |
1008 | unlock_kernel(); | ||
1009 | return ret; | ||
1000 | } | 1010 | } |
1001 | 1011 | ||
1002 | static int cosa_release(struct inode *inode, struct file *file) | 1012 | static int cosa_release(struct inode *inode, struct file *file) |