[PATCH] synclink_gt fix module reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Get module reference on open() by generic HDLC
to prevent module from unloading while interface
is active.

Signed-off-by: Paul Fulghum <[email protected]>

--- 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;
 }
 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux