From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030727AbdEWOqj (ORCPT ); Tue, 23 May 2017 10:46:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:44674 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758523AbdEWOqf (ORCPT ); Tue, 23 May 2017 10:46:35 -0400 Date: Tue, 23 May 2017 16:46:31 +0200 (CEST) From: Miroslav Benes To: "Luis R. Rodriguez" cc: shuah@kernel.org, jeyu@redhat.com, rusty@rustcorp.com.au, ebiederm@xmission.com, dmitry.torokhov@gmail.com, acme@redhat.com, corbet@lwn.net, martin.wilck@suse.com, mmarek@suse.com, pmladek@suse.com, hare@suse.com, rwright@hpe.com, jeffm@suse.com, DSterba@suse.com, fdmanana@suse.com, neilb@suse.com, linux@roeck-us.net, rgoldwyn@suse.com, subashab@codeaurora.org, xypron.glpk@gmx.de, keescook@chromium.org, atomlin@redhat.com, paulmck@linux.vnet.ibm.com, dan.j.williams@intel.com, jpoimboe@redhat.com, davem@davemloft.net, mingo@redhat.com, akpm@linux-foundation.org, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/6] module: use list_for_each_entry_rcu() on find_module_all() In-Reply-To: <20170519032444.18416-3-mcgrof@kernel.org> Message-ID: References: <20170519032444.18416-1-mcgrof@kernel.org> <20170519032444.18416-3-mcgrof@kernel.org> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 May 2017, Luis R. Rodriguez wrote: > The module list has been using RCU in a lot of other calls > for a while now, we just overlooked changing this one over to > use RCU. > > Signed-off-by: Luis R. Rodriguez > --- > kernel/module.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/module.c b/kernel/module.c > index 4a3665f8f837..70f494638974 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -602,7 +602,7 @@ static struct module *find_module_all(const char *name, size_t len, > > module_assert_mutex_or_preempt(); > > - list_for_each_entry(mod, &modules, list) { > + list_for_each_entry_rcu(mod, &modules, list) { > if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) > continue; > if (strlen(mod->name) == len && !memcmp(mod->name, name, len)) This makes sense. It would not be an issue if all callers of find_module_all() held module_mutex, but module_kallsyms_lookup_name() does not. There is one more occurrence of just list_for_each_entry(mod, &modules, list) in kernel/module.c -- in module_kallsyms_on_each_symbol(). But that one is safe because we have to hold the mutex there. Miroslav