From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A469C4CEC4 for ; Thu, 19 Sep 2019 12:55:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 163EB218AF for ; Thu, 19 Sep 2019 12:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390428AbfISMz3 (ORCPT ); Thu, 19 Sep 2019 08:55:29 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2739 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389212AbfISMz2 (ORCPT ); Thu, 19 Sep 2019 08:55:28 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 91770C78C476D9935686; Thu, 19 Sep 2019 20:55:25 +0800 (CST) Received: from [127.0.0.1] (10.57.88.168) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Thu, 19 Sep 2019 20:55:19 +0800 Subject: Re: [PATCH v4 1/3] kernel/notifier.c: intercepting duplicate registrations to avoid infinite loops To: Greg KH CC: , , , , , , , , , , , , , , , , , , , , , , , , References: <1568861888-34045-1-git-send-email-nixiaoming@huawei.com> <1568861888-34045-2-git-send-email-nixiaoming@huawei.com> <20190919063615.GA2069346@kroah.com> From: Xiaoming Ni Message-ID: Date: Thu, 19 Sep 2019 20:55:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190919063615.GA2069346@kroah.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.88.168] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Reviewed-by: Vasily Averin >> --- >> kernel/notifier.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) > > > > 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? > > > Same thing goes for all of the patches in this series. > > thanks, > > greg k-h > > . > thanks Xiaoming Ni