From: Xiaoming Ni <nixiaoming@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <akpm@linux-foundation.org>, <vvs@virtuozzo.com>,
<torvalds@linux-foundation.org>, <adobriyan@gmail.com>,
<anna.schumaker@netapp.com>, <arjan@linux.intel.com>,
<bfields@fieldses.org>, <chuck.lever@oracle.com>,
<davem@davemloft.net>, <jlayton@kernel.org>, <luto@kernel.org>,
<mingo@kernel.org>, <Nadia.Derbey@bull.net>,
<paulmck@linux.vnet.ibm.com>, <semen.protsenko@linaro.org>,
<stern@rowland.harvard.edu>, <tglx@linutronix.de>,
<trond.myklebust@hammerspace.com>, <viresh.kumar@linaro.org>,
<stable@kernel.org>, <dylix.dailei@huawei.com>,
<yuehaibing@huawei.com>, <linux-kernel@vger.kernel.org>,
<linux-nfs@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] kernel/notifier.c: intercepting duplicate registrations to avoid infinite loops
Date: Thu, 19 Sep 2019 20:55:19 +0800 [thread overview]
Message-ID: <b37575b1-2ea4-d813-c262-b52b322652c1@huawei.com> (raw)
In-Reply-To: <20190919063615.GA2069346@kroah.com>
On 2019/9/19 14:36, Greg KH wrote:
> On Thu, Sep 19, 2019 at 10:58:06AM +0800, Xiaoming Ni wrote:
>> Registering the same notifier to a hook repeatedly can cause the hook
>> list to form a ring or lose other members of the list.
>>
>> case1: An infinite loop in notifier_chain_register() can cause soft lockup
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>> atomic_notifier_chain_register(&test_notifier_list, &test2);
>>
>> case2: An infinite loop in notifier_chain_register() can cause soft lockup
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>> atomic_notifier_call_chain(&test_notifier_list, 0, NULL);
>>
>> case3: lose other hook test2
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>> atomic_notifier_chain_register(&test_notifier_list, &test2);
>> atomic_notifier_chain_register(&test_notifier_list, &test1);
>>
>> case4: Unregister returns 0, but the hook is still in the linked list,
>> and it is not really registered. If you call notifier_call_chain
>> after ko is unloaded, it will trigger oops.
>>
>> If the system is configured with softlockup_panic and the same
>> hook is repeatedly registered on the panic_notifier_list, it
>> will cause a loop panic.
>>
>> Add a check in notifier_chain_register(),
>> Intercepting duplicate registrations to avoid infinite loops
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com>
>> Reviewed-by: Vasily Averin <vvs@virtuozzo.com>
>> ---
>> kernel/notifier.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> <formletter>
>
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree. Please read:
> https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
>
thanks for your guidance
I thought that as long as the code exists in the stable branch, it should be copied to stable@kernel.org
it is my mistake,
These patches are intended to be sent to the main line.
Should I resend it again?
> </formletter>
>
> Same thing goes for all of the patches in this series.
>
> thanks,
>
> greg k-h
>
> .
>
thanks
Xiaoming Ni
next prev parent reply other threads:[~2019-09-19 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 2:58 [PATCH v4 0/3] " Xiaoming Ni
2019-09-19 2:58 ` [PATCH v4 1/3] " Xiaoming Ni
2019-09-19 6:36 ` Greg KH
2019-09-19 12:55 ` Xiaoming Ni [this message]
2019-09-19 2:58 ` [PATCH v4 2/3] kernel/notifier.c: remove notifier_chain_cond_register() Xiaoming Ni
2019-09-19 2:58 ` [PATCH v4 3/3] kernel/notifier.c: remove blocking_notifier_chain_cond_register() Xiaoming Ni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b37575b1-2ea4-d813-c262-b52b322652c1@huawei.com \
--to=nixiaoming@huawei.com \
--cc=Nadia.Derbey@bull.net \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=anna.schumaker@netapp.com \
--cc=arjan@linux.intel.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=dylix.dailei@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=jlayton@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=semen.protsenko@linaro.org \
--cc=stable@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=trond.myklebust@hammerspace.com \
--cc=viresh.kumar@linaro.org \
--cc=vvs@virtuozzo.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome