From patchwork Fri Aug 6 08:15:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 492811 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp88062jap; Fri, 6 Aug 2021 01:17:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3bIQ2bKcM1qgITFO4/nGcRM1kOWJPZT+yC3pY6rEokamaSRyPr+YwEk3PMlJq3vQrKzB3 X-Received: by 2002:a6b:7309:: with SMTP id e9mr554241ioh.183.1628237863146; Fri, 06 Aug 2021 01:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628237863; cv=none; d=google.com; s=arc-20160816; b=ynDMTwMysypRE1wf4Xq+8LKmZpGjEk/iVlkLoWIhjyyNI4WYz8XRo7FKplodGk5z6X amoqVln9BzcW2rvlPIRKCsj9CEg61o/t/9CVc3kpROqfcsqIB4weU8B69YkLAntmjfcq wKb5sbaExfe9OqRYFzNidVOgPCmKygPPN92Xzv+9g2Wg3ce1CEbNjZ6ga7yW/gnjgNzT GI+Cn3d7ASZ1y1ICmvd8cdW6+uTx+TAfjnZSj83Xun/UHP/OLNZkcFU2K0tGd7ezXOY+ jPz9Z3D7RilFGWcz+2fBVltxPDQtTr+7as6hIrNk1/LfzBwkcirr+7ckYP1TFA0hHZZu 6PwQ== 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=7YOvKhCSEbZNmS1eBXiBMmWnmq73o6qaPnkMV9e6veQ=; b=RYVYzNk+3va7fQkKd/sOePEahTqtOaMQoVJ+AIfouwr6wc5O3HWX1rtaV+718iFEll 8oqBv9TXFemtQelgZJ7NFnk5SscIEzX26iN7oLSGowlYLnl83Zt8+on1Ul44kX7E1FU+ TX5uzj9cUtHO/b4k/7/by51h9gub8GPRsNHTbsaniz6n05+LHyyL6Xbidl8pneR6uB2T /85NfdIc19t3Z5cDv5TukOPfWYlb54M1VbnZZK2EyjBIny1OQ+LYAXkvcpP/GqAgB4zO Ycbtf1y7ovQKPjwcBJvfjEEfNrhaUi6RT+Cw5UI+sBqkaIHgmmGjaZL9D2taPS0nLUDo BAwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KsiXmZV2; 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 i26si8635232jav.73.2021.08.06.01.17.42; Fri, 06 Aug 2021 01:17:43 -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=KsiXmZV2; 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 S231694AbhHFIRy (ORCPT + 12 others); Fri, 6 Aug 2021 04:17:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:46694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243968AbhHFIQ0 (ORCPT ); Fri, 6 Aug 2021 04:16:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 79BB0611B0; Fri, 6 Aug 2021 08:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237769; bh=LGdwMPGAArhAr7M+aDTGi+jhjUT4W9+pivQr2HyCql0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KsiXmZV2tlFBe1YjSBRmHIcqIZ7noN+VzxLGQtvK2iorn270ShYr5j90XIqz+t3tx dFPAOaAOIs7oc3cjC//OalU7bBj9rCvkH2FfjsNzI5mGYyySeS6cDJUm/qkTYdc28J v043XSO5dn0SWTH7WCad13B2jtk9Drq64NjTXaw0= 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 Subject: [PATCH 4.19 13/16] firmware: arm_scmi: Ensure drivers provide a probe function Date: Fri, 6 Aug 2021 10:15:04 +0200 Message-Id: <20210806081111.567120425@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081111.144943357@linuxfoundation.org> References: <20210806081111.144943357@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 commit 5e469dac326555d2038d199a6329458cc82a34e5 upstream. 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: Greg Kroah-Hartman --- drivers/firmware/arm_scmi/bus.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/firmware/arm_scmi/bus.c +++ b/drivers/firmware/arm_scmi/bus.c @@ -100,6 +100,9 @@ int scmi_driver_register(struct scmi_dri { int retval; + if (!driver->probe) + return -EINVAL; + driver->driver.bus = &scmi_bus_type; driver->driver.name = driver->name; driver->driver.owner = owner;