diff options
author | Paul Fulghum <paulkf@microgate.com> | 2007-08-22 17:01:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-22 22:52:46 -0400 |
commit | d4c63b7c74507c424afcc9c80ba77a55bfb0d07e (patch) | |
tree | 787e2771cff667e7e2494138475409c27e511517 | |
parent | 1807a1aaf5f2a35ea6d4b527b28bc8889d255a2f (diff) |
synclink_gt fix module reference
Get module reference on open() by generic HDLC to prevent module from
unloading while interface is active.
Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/char/synclink_gt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index bbb7f1292665..2f97d2f8f916 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -1565,6 +1565,9 @@ static int hdlcdev_open(struct net_device *dev) | |||
1565 | int rc; | 1565 | int rc; |
1566 | unsigned long flags; | 1566 | unsigned long flags; |
1567 | 1567 | ||
1568 | if (!try_module_get(THIS_MODULE)) | ||
1569 | return -EBUSY; | ||
1570 | |||
1568 | DBGINFO(("%s hdlcdev_open\n", dev->name)); | 1571 | DBGINFO(("%s hdlcdev_open\n", dev->name)); |
1569 | 1572 | ||
1570 | /* generic HDLC layer open processing */ | 1573 | /* generic HDLC layer open processing */ |
@@ -1634,6 +1637,7 @@ static int hdlcdev_close(struct net_device *dev) | |||
1634 | info->netcount=0; | 1637 | info->netcount=0; |
1635 | spin_unlock_irqrestore(&info->netlock, flags); | 1638 | spin_unlock_irqrestore(&info->netlock, flags); |
1636 | 1639 | ||
1640 | module_put(THIS_MODULE); | ||
1637 | return 0; | 1641 | return 0; |
1638 | } | 1642 | } |
1639 | 1643 | ||