From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753770AbbAUDWl (ORCPT ); Tue, 20 Jan 2015 22:22:41 -0500 Received: from ozlabs.org ([103.22.144.67]:33761 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751691AbbAUDWk convert rfc822-to-8bit (ORCPT ); Tue, 20 Jan 2015 22:22:40 -0500 From: Rusty Russell To: Andrey Tsyvarev Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Subject: Re: [PATCH] kernel/module.c: Free lock-classes if parse_args failed In-Reply-To: <54BE082A.20207@ispras.ru> References: <1421216708-1975-1-git-send-email-tsyvarev@ispras.ru> <87iog2arfk.fsf@rustcorp.com.au> <54BE082A.20207@ispras.ru> User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 21 Jan 2015 12:10:53 +1030 Message-ID: <87d268c3mi.fsf@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrey Tsyvarev writes: > 20.01.2015 9:37, Rusty Russell пишет: >> Andrey Tsyvarev writes: >>> parse_args call module parameters' .set handlers, which may use locks defined in the module. >>> So, these classes should be freed in case parse_args returns error(e.g. due to incorrect parameter passed). >> Thanks, this seems right. Applied. >> >> But this makes me ask: where is lockdep_free_key_range() called on the >> module init code? It doesn't seem to be at all... > As I understand, locks are not allowed to be defined in the module init > section. So, no needs to call lockdep_free_key_range() for it. > This has a sense: objects from that section are allowed to be used only > by module->init() function. But a single function call doesn't require > any synchronization wrt itself. I don't know that we have any __initdata locks; it would be really weird. But change 'static DEFINE_MUTEX(mutex_param);' to 'static __initdata DEFINE_MUTEX(mutex_param);' to test. Cheers, Rusty.