All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] synclink_gt fix module reference
@ 2007-08-14 17:39 Paul Fulghum
  0 siblings, 0 replies; only message in thread
From: Paul Fulghum @ 2007-08-14 17:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel@vger.kernel.org

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>

--- a/drivers/char/synclink_gt.c	2007-07-08 18:32:17.000000000 -0500
+++ b/drivers/char/synclink_gt.c	2007-08-14 12:27:50.000000000 -0500
@@ -1570,6 +1570,9 @@ static int hdlcdev_open(struct net_devic
 	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 */
@@ -1639,6 +1642,7 @@ static int hdlcdev_close(struct net_devi
 	info->netcount=0;
 	spin_unlock_irqrestore(&info->netlock, flags);
 
+	module_put(THIS_MODULE);
 	return 0;
 }
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-08-14 18:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-14 17:39 [PATCH] synclink_gt fix module reference Paul Fulghum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.