From: Paul Fulghum Date: Wed, 22 Aug 2007 21:01:50 +0000 (-0700) Subject: synclink_gt fix module reference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d4c63b7c74507c424afcc9c80ba77a55bfb0d07e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) int rc; unsigned long flags; + if (!try_module_get(THIS_MODULE)) + return -EBUSY; + DBGINFO(("%s hdlcdev_open\n", dev->name)); /* generic HDLC layer open processing */ @@ -1634,6 +1637,7 @@ static int hdlcdev_close(struct net_device *dev) info->netcount=0; spin_unlock_irqrestore(&info->netlock, flags); + module_put(THIS_MODULE); return 0; }