From patchwork Wed Aug 4 11:35:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 491654 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp1537975jap; Wed, 4 Aug 2021 04:35:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx+pcnk4RQi31dYvaS9LQkrTrYVIVfv7HwBXAlVZ5hkBaadKFWAngc0Aj8YviLi8Z1uQj1 X-Received: by 2002:aa7:da02:: with SMTP id r2mr31683798eds.249.1628076926163; Wed, 04 Aug 2021 04:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628076926; cv=none; d=google.com; s=arc-20160816; b=XeIm2puzXujnpqFKidVkajNnzZ/kwlHqonhtH0cvJyel2kM6bOobYwUIPkZrIunHcl 8n1lSVmBrSlv5N9s5rSOJoK6leieycFYxWpOiqq4GjbAJphdIKNrhh0jUwE3EPlsMwCB C+BduR1Tho4tB9fPU94+dMVsNo6o9m6wcsRnJdAwXOWowAHUcIudjCvIEfMGSCaeJd5N J+DITdB3ss8dOUjApW0MITIAqou5I2VCYeyI6z2tOYtY3tvPMD9ZevsisiozVbZPvMyi mj/tYRXqUow0rziZXucOFhY0nVqiVs2rqBezkE9N73gddsGMtEaAmfczzFIVouhBYpvi Nyhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KbPbJEmFhQUMRO+x8YhiU5y4X9bdTdVJrt+p8xEXMT4=; b=DYPrdgEO+BOuHhgWuOUUrQ4TSHTCkdIP0iL31ukVdqLMNxUnlZEo8E6HXFv0Blr1RX g/Ld8UgaJUcocYq+rErpM8q1P3LaqCcyRSFztFWMs5nRC67yIu0RmNANrb7tL0suwspa Z2pGh+q6GoaNcEyN5NzcDeOFCsJkCE2/rrGLy+XK8f2bTU0pMNbWKtH518XfyYlBYddH DQRkdlHwaO7FTPxZLkhW6HZV1KXX2HhCE1cnNpQU9OBzmT70doMUJ3DVqQm/FWqJ2aNG g9meeqQyivPpybY6CVUvyQhhhDwP/CBUKi4l731tsy9da02vtf/lah5gXpMbWYMt6YF7 5zzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si2098946edb.423.2021.08.04.04.35.25; Wed, 04 Aug 2021 04:35:26 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237651AbhHDLfe (ORCPT + 12 others); Wed, 4 Aug 2021 07:35:34 -0400 Received: from foss.arm.com ([217.140.110.172]:59626 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237581AbhHDLfd (ORCPT ); Wed, 4 Aug 2021 07:35:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DABCF13D5; Wed, 4 Aug 2021 04:35:20 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B33483F719; Wed, 4 Aug 2021 04:35:19 -0700 (PDT) From: Cristian Marussi To: stable@vger.kernel.org Cc: gregkh@linuxfoundation.org, sashal@kernel.org, cristian.marussi@arm.com, Sudeep Holla Subject: [PATCH] firmware: arm_scmi: Ensure drivers provide a probe function Date: Wed, 4 Aug 2021 12:35:08 +0100 Message-Id: <20210804113508.7131-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudeep Holla [ Upstream commit 5e469dac326555d2038d199a6329458cc82a34e5 ] The bus probe callback calls the driver callback without further checking. Better be safe than sorry and refuse registration of a driver without a probe function to prevent a NULL pointer exception. Cc: # v4.19+ Link: https://lore.kernel.org/r/20210624095059.4010157-2-sudeep.holla@arm.com Fixes: 933c504424a2 ("firmware: arm_scmi: add scmi protocol bus to enumerate protocol devices") Reported-by: Uwe Kleine-König Tested-by: Cristian Marussi Reviewed-by: Cristian Marussi Acked-by: Uwe Kleine-König Signed-off-by: Sudeep Holla --- Upstream commit 5e469dac326555d2038d199a6329458cc82a34e5 has been already applied to stable/linux-5.13.y, this is a backport with conflicts resolved for v4.19, v5.4 and v5.10. (SCMI stack did not even exist before 4.19) --- drivers/firmware/arm_scmi/bus.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 7a30952b463d..66d445b14e51 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -100,6 +100,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner, { int retval; + if (!driver->probe) + return -EINVAL; + driver->driver.bus = &scmi_bus_type; driver->driver.name = driver->name; driver->driver.owner = owner;