On 19 Jun 00 at 23:54, Andrew Morton wrote:
> @@ -664,8 +665,13 @@
> * Call device private open method
> */
>
> - if (dev->open)
> + if (dev->open) {
> + if (dev->owner)
> + __MOD_INC_USE_COUNT(dev->owner);
> ret = dev->open(dev);
> + if (ret != 0 && dev->owner)
> + __MOD_DEC_USE_COUNT(dev->owner);
> + }
You should change it to
if (dev->owner)
__MOD_INC_USE_COUNT(dev->owner);
if (dev->open)
ret = dev->open(dev);
if (ret != 0 && dev->owner)
__MOD_DEC_USE_COUNT(dev->owner);
...
as 'ret' is preinitialized to 0, so NULL ->open is allowed - your
code will decrement usage count below zero in release code for
devices with NULL open... (there are no such devices just now as
currently you must do at least MOD_INC_USE_COUNT in open, but in
future... Or change it to if (!dev->open) BUG(); ...)
Best regards,
Petr Vandrovec
vandrove@xxxxxxxxxx
P.S.: It would be really nice if each 2.4.0-acXX could differ in
LINUX_VERSION_CODE... It is really hard to maintain module (vmmon/vmnet)
for 22 different kernels which all presents as 2.4.0 :-( And we have
even more of 2.3.99 flawors...
|