Messages in this thread Patch in this message | | | Date | Thu, 29 Apr 2004 10:53:21 +0200 | From | Michael Hunold <> | Subject | [PATCH][2.6] DVB:Fix adapter module removal bug |
| |
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. 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; } | |