From patchwork Wed Sep 21 12:33:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 9343441 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 842E7607D4 for ; Wed, 21 Sep 2016 12:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 761272A612 for ; Wed, 21 Sep 2016 12:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 693F92A613; Wed, 21 Sep 2016 12:35:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 363D8284B1 for ; Wed, 21 Sep 2016 12:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756008AbcIUMex (ORCPT ); Wed, 21 Sep 2016 08:34:53 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:19492 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756023AbcIUMew (ORCPT ); Wed, 21 Sep 2016 08:34:52 -0400 Received: from [10.30.3.27] ([10.30.3.27]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u8JLfaBA014761; Tue, 20 Sep 2016 00:41:36 +0300 (MSK) From: Vasily Averin Subject: [PATCH 2/2] notifiers: double register detection To: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Cc: "J. Bruce Fields" , Jeff Layton , Scott Mayhew Message-ID: <105a9bce-5539-73f1-2683-e52dba870c04@virtuozzo.com> Date: Wed, 21 Sep 2016 15:33:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP WARN_ON should help to detect double register of the same notifiers Signed-off-by: Vasily Averin --- kernel/notifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/notifier.c b/kernel/notifier.c index fd2c9ac..e02b2f0 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -22,6 +22,7 @@ static int notifier_chain_register(struct notifier_block **nl, struct notifier_block *n) { while ((*nl) != NULL) { + WARN_ON((*nl) == n); if (n->priority > (*nl)->priority) break; nl = &((*nl)->next);