summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb
diff options
context:
space:
mode:
authorMichael Hunold <devnull@localhost>2004-04-29 08:32:24 +0000
committerMichael Hunold <devnull@localhost>2004-04-29 08:32:24 +0000
commit7785d93e022ace0b0504746fd5169db1d751d1f6 (patch)
tree815590fd5d6af8be4090dfb1fcd909c6c9f4c448 /linux/drivers/media/dvb
parent94f0f02d4bb06b486011d1b642b857c1498a8fea (diff)
downloadmediapointer-dvb-s2-7785d93e022ace0b0504746fd5169db1d751d1f6.tar.gz
mediapointer-dvb-s2-7785d93e022ace0b0504746fd5169db1d751d1f6.tar.bz2
- protect adapter module from removal after net interface has been set up
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index db10fab56..f4fb2bd08 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1177,9 +1177,15 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
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;
}
@@ -1206,6 +1212,7 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
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 */
@@ -1216,9 +1223,15 @@ static int dvb_net_do_ioctl(struct inode *inode, struct file *file,
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;
}