From patchwork Tue Feb 27 14:09:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 129793 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1436054lja; Tue, 27 Feb 2018 06:09:50 -0800 (PST) X-Google-Smtp-Source: AH8x227XFxLHq2A05E9TJyYATAspU7++5tRJLwc2Tga/vmzOjOXY7W2xn8rQuVeSl+KkA+0nXJ7g X-Received: by 10.98.202.23 with SMTP id n23mr14314525pfg.52.1519740590178; Tue, 27 Feb 2018 06:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519740590; cv=none; d=google.com; s=arc-20160816; b=x8pZA0KHKyS/IPlpobL6+fFBywWNtftiIzEow+hPU21Ttjh6awwTizy1UBsVtlq3YS j2U01uR7jNmE+ccAvD07+x4KCKSt5RASvPwIb4pWUDhhZEt4VmVy2dQ9SlVfyMrnLmLu dZ4BOMiFJ2JGfwKvwu6tNmDftQCUXEYX9ciT8rau0VhNj9I+WxjgIwuyT49zWqcqzHIX 6NgM6WIjJZUMPPUA4wHshoVG/Vle1E/3ZzmqHE1RAeH2q2QAUGL7CuwqpYAHbV4SRLPZ IB8UVT5kTTSMBhGenCi6iq2M7D0jdTwWlWwT6kGMAmMmZzaz9CsTUPU+tTPWxnVir615 aq2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=W3wjbxDBkF2MuZXB912inTUGuX59niYARYQ11GTwSsBHeUOQZ+aA1b+Vo7K2Kol0F1 I+s/8Nq4h8gXWwXYrodxyz/WWX7SPPd9SVeARklbNWG75tQEwBOxB35sC2h7vuzfN6mB gBN9EivpJaVcjucrJfIkBKrE481MG6juAUOpbtFzQe40VUr7ocVRQG3PcMtwlrwJx2C3 Wr7LCVc39ahf8JiiysOdj/h1/ArcXBfwwUdmdxcbIVw9LbrNHRjc2w9VcgPiBFyGpspX zengZultSvkgPUy6h/GyO0UKULO1GLYmW7KYBvTCrDnJWPnLEgYyKKEsYaXGwbobS8wa HESQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ods7cilq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si8662317plk.699.2018.02.27.06.09.49; Tue, 27 Feb 2018 06:09:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ods7cilq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbeB0OJp (ORCPT + 28 others); Tue, 27 Feb 2018 09:09:45 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54608 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753790AbeB0OJn (ORCPT ); Tue, 27 Feb 2018 09:09:43 -0500 Received: by mail-wm0-f68.google.com with SMTP id z81so24293739wmb.4 for ; Tue, 27 Feb 2018 06:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=Ods7cilqPhNaxE4tyik8AZ2peEbqRCRPiDxn02WsvA6n/BzqNmgn0yMa4Po9AmKyGM AENOAD5zTAdjaPd0V5a/SNfLLlBz4VVULmqgDSjIlht4azLEloA/uQ5QLscZOFOvHkOd dnZMZnVqNf3O3V8jAl2/orYWKbtLyuCfvA0Rg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+qPp2gLc0zJ8QDezJSeSnIvB+cVCQ5fMNsIOfQ1z91Q=; b=SzlJWVVkQUXGf6BwhihmSYpORl/4ZurdMdFCWN1F56VwoiRh9B+YwanxhERz9ECo1e kHLCCr0Y5hG6SyFfFz01sHUSnXC9prcAHYTIzzB+On/Git+2BCcp8Cz2vnwCNHlVFb+K 0Qzmz1E275tBk9vLDGhwIwFrRa91a9dWS4aSJHZ+H3x5E/fWMU/Dj02ALUav+k2c0bFb zI2EmVejwkeDIZqw7et6h3GCn/P3O9llk3p0yaeiT5/S7G6S1Lm+X+c8CH7k7kCdudxT Zeoe3dA2CSnJNsGlK72BbjQ2sjrylC6uPQXVoJAhhTOqcMO/vcVZkNM7AN0SVLireJHp tI6w== X-Gm-Message-State: APf1xPB+dksrtVfi0cO0QKeLA8s6OAYwZwQSH2GY38wU6OwtAHYinm+4 eLuqW/xmNKDc1hyOwwmjeAyuKA== X-Received: by 10.28.245.3 with SMTP id t3mr10887727wmh.134.1519740582312; Tue, 27 Feb 2018 06:09:42 -0800 (PST) Received: from lmecxl0911.lme.st.com ([80.214.71.157]) by smtp.gmail.com with ESMTPSA id 59sm6514496wro.57.2018.02.27.06.09.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 06:09:41 -0800 (PST) From: Benjamin Gaignard X-Google-Original-From: Benjamin Gaignard To: gregkh@linuxfoundation.org, robh+dt@kernel.org, mark.rutland@arm.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Benjamin Gaignard Subject: [PATCH 1/3] driver core: check notifier_call_chain return value Date: Tue, 27 Feb 2018 15:09:24 +0100 Message-Id: <20180227140926.22996-2-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20180227140926.22996-1-benjamin.gaignard@st.com> References: <20180227140926.22996-1-benjamin.gaignard@st.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When being notified that a driver is about to be bind a listener could return NOTIFY_BAD. Check the return to be sure that the driver could be bind. Signed-off-by: Benjamin Gaignard --- drivers/base/dd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.15.0 diff --git a/drivers/base/dd.c b/drivers/base/dd.c index de6fd092bf2f..9275f2c0fed2 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -304,9 +304,12 @@ static int driver_sysfs_add(struct device *dev) { int ret; - if (dev->bus) - blocking_notifier_call_chain(&dev->bus->p->bus_notifier, - BUS_NOTIFY_BIND_DRIVER, dev); + if (dev->bus) { + if (blocking_notifier_call_chain(&dev->bus->p->bus_notifier, + BUS_NOTIFY_BIND_DRIVER, dev) == + NOTIFY_BAD) + return -EINVAL; + } ret = sysfs_create_link(&dev->driver->p->kobj, &dev->kobj, kobject_name(&dev->kobj));