Received: by oss.sgi.com id ; Mon, 19 Jun 2000 08:21:14 -0700 Received: from zikova.cvut.cz ([147.32.235.100]:5383 "EHLO zikova.cvut.cz") by oss.sgi.com with ESMTP id ; Mon, 19 Jun 2000 08:20:50 -0700 Received: from vcnet.vc.cvut.cz (vcnet.vc.cvut.cz [147.32.240.61]) by zikova.cvut.cz (8.9.0.Beta5/8.9.0.Beta5) with ESMTP id RAA16970; Mon, 19 Jun 2000 17:20:15 +0200 Received: from VCNET/SpoolDir by vcnet.vc.cvut.cz (Mercury 1.21); 19 Jun 100 17:20:15 MET-1MEST Received: from SpoolDir by VCNET (Mercury 1.30); 19 Jun 100 17:20:09 MET-1MEST From: "Petr Vandrovec" Organization: CC CTU Prague To: andrewm@uow.edu.au Date: Mon, 19 Jun 2000 17:20:04 MET-1 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: modular net drivers CC: netdev@oss.sgi.com X-mailer: Pegasus Mail v3.40 Message-ID: <600FE22630F@vcnet.vc.cvut.cz> Sender: owner-netdev@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;netdev-outgoing 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@vc.cvut.cz 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...