Commit 0978a298 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] DVB:Fix adapter module removal bug

From: Michael Hunold <hunold@convergence.de>

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.
parent 8be18297
......@@ -1095,9 +1095,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;
}
......@@ -1120,6 +1126,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 */
......@@ -1130,9 +1137,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment