From patchwork Mon Jul 26 15:37:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 485843 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp3976723jao; Mon, 26 Jul 2021 09:14:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygHIpayyIfqMA4blwtF7r5Pot+mKwP6sbPrZL3g1kyB0fHz8WTrFS+YofHq2P4WFGb++k/ X-Received: by 2002:a50:9350:: with SMTP id n16mr9246156eda.176.1627316052419; Mon, 26 Jul 2021 09:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627316052; cv=none; d=google.com; s=arc-20160816; b=SMOeTm5AmSgAXOK3YXNy7lTWJploy9LnnLAUROCoeuQS1G5ySUslgVtM7UYcRS1v5M ejdnL3qyYuvfkfr1S6+YvY0haVswf0SQTPZOhJhF66sQC8XVFwvfPYW/KrBrMG0yHySV uXMeFKZgXbOhiV+Hs+iYuQdhwU1L5z53CxpY0C+r+8ElYqiD7Z7sineJhE2HU274rOdL fwidzYwFYyXTTX1x4Oh2GbUcq0HdEq0pdv7/h0yrpvwENwZ7uMu67fnbGwD3SaHMTTss 5KhXPQ8/7lEhS85maBM98oa6EU7tSEXFu8ae0UQhLoCfBKa6SOZb5+DuXaz/2xdx7c9j O2xQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4EMgMbNUZJ0l379d5+FKe7U5l62TI0xX6Gd8yE0fA1Q=; b=ck2TaBa6DgWFTlyOiSUEkHHFCMbczcywZp0hpH4tHcWmGYqYkHdNBA4u9FfDN+sj/D FwYUsKIWyXiJMWoX4fljdM9g4UhoayJKwbHw9suNIoc0JakQfp1i27ECw/hhFDNAMRJ/ KGe7MiBHhlZrFhrKoiAubvlnhI2xXF+1NkV6vKdFbYqau4WX2ywL7VANRaptUEnc/uq9 Ou2tcYS9/JqP/HabJ2/G+rs1IatNDgTnZ2aVuPjedfbRnMKmj8Mlrm6i2u6y+Era3fvt fdo4kOA0lXJzOuj+4/iTLxOS+p/6xy2+xebgTXMqf7jXUAAva8fSZF95ioNQBkh5p/Sk 6nng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bXkUlQS8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pv18si289902ejb.567.2021.07.26.09.14.12; Mon, 26 Jul 2021 09:14:12 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bXkUlQS8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231455AbhGZPbM (ORCPT + 12 others); Mon, 26 Jul 2021 11:31:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237857AbhGZP30 (ORCPT ); Mon, 26 Jul 2021 11:29:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DAD1061055; Mon, 26 Jul 2021 16:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315739; bh=+8MRPLCYnkuxgtHkVaX8KPGreU4W61RC4jdCxc67wuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXkUlQS8S6GWwHQXYBZ58Vs6VNsnZ76p20voMi0kNkz703hJ3YP8su6QzNVN78V5D dbC1KDpkPP5+u9w8G5zvduZC3TpBOV0m4WbYqm5lDY7h15N5Y+4ysvr7FY5dvapCG1 lu8oPwmniArSGDPpC2OU+6scWyJeEUgDnlfUj8/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Cristian Marussi , Sudeep Holla , Sasha Levin Subject: [PATCH 5.13 048/223] firmware: arm_scmi: Ensure drivers provide a probe function Date: Mon, 26 Jul 2021 17:37:20 +0200 Message-Id: <20210726153847.842147348@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153846.245305071@linuxfoundation.org> References: <20210726153846.245305071@linuxfoundation.org> User-Agent: quilt/0.66 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. 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 Signed-off-by: Sasha Levin --- drivers/firmware/arm_scmi/bus.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.30.2 diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c index 784cf0027da3..9184a0d5acbe 100644 --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -139,6 +139,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner, { int retval; + if (!driver->probe) + return -EINVAL; + retval = scmi_protocol_device_request(driver->id_table); if (retval) return retval;