From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752622AbZBDKMV (ORCPT ); Wed, 4 Feb 2009 05:12:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754998AbZBDKL6 (ORCPT ); Wed, 4 Feb 2009 05:11:58 -0500 Received: from caramon.arm.linux.org.uk ([78.32.30.218]:48878 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754888AbZBDKL5 (ORCPT ); Wed, 4 Feb 2009 05:11:57 -0500 Date: Wed, 4 Feb 2009 10:11:30 +0000 From: Russell King To: Rusty Russell Cc: Karsten Keil , linux-kernel@vger.kernel.org, Michal Hocko , richard kennedy , Dan Williams , Dmitry Torokhov , dwmw2@infradead.org, Scott Wood , netdev@vger.kernel.org, Al Viro Subject: Re: [RFC] Suspicious bug in module refcounting Message-ID: <20090204101130.GB19498@flint.arm.linux.org.uk> References: <20090203134721.GA11069@pingi.kke.suse.de> <200902041418.09630.rusty@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200902041418.09630.rusty@rustcorp.com.au> User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 04, 2009 at 02:18:08PM +1030, Rusty Russell wrote: > gameport.c, serio.c and input.c increment their own refcount, but to get > into those init functions someone must be holding a refcount already (ie. a > module depends on this module). Ditto cyber2000fb.c, and MTD. Err, wrong. cyber2000fb.c does it in its module initialization function to prevent the module (when built for Shark) from being unloaded. It does this because it's from the days of 2.2 kernels and no one bothered writing the module unload support for Shark. I'm certainly not in a position to do that. Since you can't unload a module while its initialization function is running, so someone else must be holding a refcount (the insmod process). I'm not saying that it's the right solution, I'm saying that this is how it's evolved. If someone has an idea on what to do about it then patches will be given due consideration. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: