[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190919063615.GA2069346@kroah.com>
Date: Thu, 19 Sep 2019 08:36:15 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Xiaoming Ni <nixiaoming@...wei.com>
Cc: akpm@...ux-foundation.org, vvs@...tuozzo.com,
torvalds@...ux-foundation.org, adobriyan@...il.com,
anna.schumaker@...app.com, arjan@...ux.intel.com,
bfields@...ldses.org, chuck.lever@...cle.com, davem@...emloft.net,
jlayton@...nel.org, luto@...nel.org, mingo@...nel.org,
Nadia.Derbey@...l.net, paulmck@...ux.vnet.ibm.com,
semen.protsenko@...aro.org, stern@...land.harvard.edu,
tglx@...utronix.de, trond.myklebust@...merspace.com,
viresh.kumar@...aro.org, stable@...nel.org,
dylix.dailei@...wei.com, yuehaibing@...wei.com,
linux-kernel@...r.kernel.org, linux-nfs@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v4 1/3] kernel/notifier.c: intercepting duplicate
registrations to avoid infinite loops
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@...wei.com>
> Reviewed-by: Vasily Averin <vvs@...tuozzo.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.
</formletter>
Same thing goes for all of the patches in this series.
thanks,
greg k-h
Powered by blists - more mailing lists