public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][2.6] DVB:Fix adapter module removal bug
@ 2004-04-29  8:53 Michael Hunold
  0 siblings, 0 replies; only message in thread
From: Michael Hunold @ 2004-04-29  8:53 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

Hello,

unfortunately it's possible to remove a DVB adapter module even if a DVB 
network device has been set up using this adapter.

The attached patch fixes this problem. Please apply. Thanks!

CU
Michael.

[-- Attachment #2: dvb_net.diff --]
[-- Type: text/plain, Size: 1261 bytes --]

diff -ur xx-linux-2.6.6-rc3/drivers/media/dvb/dvb-core/dvb_net.c linux-2.6.6-rc3/drivers/media/dvb/dvb-core/dvb_net.c
--- xx-linux-2.6.6-rc3/drivers/media/dvb/dvb-core/dvb_net.c	2004-04-29 10:38:36.000000000 +0200
+++ linux-2.6.6-rc3/drivers/media/dvb/dvb-core/dvb_net.c	2004-04-29 10:45:46.000000000 +0200
@@ -1095,9 +1095,15 @@
 		
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
+			
+		if (!try_module_get(dvbdev->adapter->module))
+			return -EPERM;
+
 		result=dvb_net_add_if(dvbnet, dvbnetif->pid, dvbnetif->feedtype);
-		if (result<0)
+		if (result<0) {
+			module_put(dvbdev->adapter->module);
 			return result;
+		}
 		dvbnetif->if_num=result;
 		break;
 	}
@@ -1120,6 +1126,7 @@
 	case NET_REMOVE_IF:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
+		module_put(dvbdev->adapter->module);
 		return dvb_net_remove_if(dvbnet, (int) (long) parg);
 
 	/* binary compatiblity cruft */
@@ -1130,9 +1137,15 @@
 
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
+
+		if (!try_module_get(dvbdev->adapter->module))
+			return -EPERM;
+
 		result=dvb_net_add_if(dvbnet, dvbnetif->pid, DVB_NET_FEEDTYPE_MPE);
-		if (result<0)
+		if (result<0) {
+			module_put(dvbdev->adapter->module);
 			return result;
+		}
 		dvbnetif->if_num=result;
 		break;
 	}

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

only message in thread, other threads:[~2004-04-29  8:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-29  8:53 [PATCH][2.6] DVB:Fix adapter module removal bug Michael Hunold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox