Received: by 2002:a05:6a10:8a47:0:0:0:0 with SMTP id dn7csp267084pxb; Mon, 8 Nov 2021 08:47:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpx24uDLGmX4ILG3vc8T5ecTfxDd7AylKsYFWQFo17AT+JyKQ7wwGDUnx44GI9EcbkXurb X-Received: by 2002:a05:6402:40d4:: with SMTP id z20mr654094edb.210.1636390045528; Mon, 08 Nov 2021 08:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636390045; cv=none; d=google.com; s=arc-20160816; b=k4OI6oYkFG5JdKWtrHtuxzasQOaDc1QaFnagL3s9mtyVB4cY3wqGlxSiEPiszPWizJ 7mXZbVeR6d45cYCS3MzhWkl5l4ezoixJ9XWYnGK+hAT80U5gnjFgxc3LZf+t5IyqQaM1 P8v2kX3yBoUacyxvB2hYvg+cxW8heL+NOB6bN+3q0xYdCkpptqQay7qWdYfZmQYHAiCG oYFbjAcZdXzzw7ajaK1HHcShjwElVCaeo9V61RWpQy28O5o2ARuVRJ+61B7oeSqZ09ia Xx8GVGa4CN1GxsL5h6TgbLtPsv66SHaB7GBrwirGn6KQ0APz9fjoL4+Tlu4Vz12pn/1b Jdsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=8F18tgLVzQvnAhvreiF8jEWHWIsOwL7oYsjFXCpcFro=; b=U3+rPGsc19bTr9qzHHUzYP7hlT6HDETTk/H7UYLs91fddUnDmr4taOJIRcXPyHxqgP joBMXqsdLZIcFt9WJfl5kOkSaNXSyR6ULaYdzeVEa7IvFAVgH22yxEtTL5zC+7Rm/pPx 3WKQOOUKj3gkEA4WawwKHdQEXErO1hiOi+nUTkRXN4KLQuc8DFwBu40p7XB3Vfe2lXPS rolaMPU9c4ilMvzKchYqsTrf14G1YIf9zTwPKt3jeGHRSyb2TfOHaJ+/Xa6iiz/bEm+y B4N09NGGKqL35HT7R3rIF72vcVTzJ2HASGhLsPBOZ7b3ahkHVBZBmeI3pbBQ4iXlNhZ/ FzwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f15si22398960edd.398.2021.11.08.08.47.02; Mon, 08 Nov 2021 08:47:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240199AbhKHOIj (ORCPT + 99 others); Mon, 8 Nov 2021 09:08:39 -0500 Received: from netrider.rowland.org ([192.131.102.5]:37655 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S236375AbhKHOIj (ORCPT ); Mon, 8 Nov 2021 09:08:39 -0500 Received: (qmail 1666786 invoked by uid 1000); 8 Nov 2021 09:05:53 -0500 Date: Mon, 8 Nov 2021 09:05:53 -0500 From: Alan Stern To: Borislav Petkov Cc: LKML , linux-usb@vger.kernel.org Subject: Re: [PATCH v0 16/42] USB: Check notifier registration return value Message-ID: <20211108140553.GA1666297@rowland.harvard.edu> References: <20211108101157.15189-1-bp@alien8.de> <20211108101157.15189-17-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211108101157.15189-17-bp@alien8.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 11:11:31AM +0100, Borislav Petkov wrote: > From: Borislav Petkov > > Avoid homegrown notifier registration checks. This is a rather misleading description. The patch does exactly the opposite: It _adds_ a homegrown notifier registration check. (Homegrown in the sense that the check is made by the individual caller rather than being centralized in the routine being called.) Alan Stern > No functional changes. > > Signed-off-by: Borislav Petkov > Cc: linux-usb@vger.kernel.org > --- > drivers/usb/core/notify.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c > index e6143663778f..80d1bfa61887 100644 > --- a/drivers/usb/core/notify.c > +++ b/drivers/usb/core/notify.c > @@ -28,7 +28,8 @@ static BLOCKING_NOTIFIER_HEAD(usb_notifier_list); > */ > void usb_register_notify(struct notifier_block *nb) > { > - blocking_notifier_chain_register(&usb_notifier_list, nb); > + if (blocking_notifier_chain_register(&usb_notifier_list, nb)) > + pr_warn("USB change notifier already registered\n"); > } > EXPORT_SYMBOL_GPL(usb_register_notify); > > -- > 2.29.2 >