Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp272057pxt; Fri, 6 Aug 2021 01:25:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXJKD65XMp2H6Sm2g7mf4WHfpWtm5GsEWObmNgOoW44pA2bB8gZDSBrgKajPwtRcSY2Y6c X-Received: by 2002:a05:6402:4384:: with SMTP id o4mr11801175edc.124.1628238315238; Fri, 06 Aug 2021 01:25:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628238315; cv=none; d=google.com; s=arc-20160816; b=ZSFlO9qqEL6FKrka4B+ZeMF97pM8vFK1EiqEeijJB1ug7SWoapK9cBseLwZVGexo62 TO0g5aRRTSb1lDlb878hTusysPD60FQb/A409mzqIApyYZNsbWj6XhPVuuCVJ6ccM0Lo B0zzIqYHWIAtMW48fLfh7z8ARB+KWjdbKtUXnA1py50lkH2/WbiWNGjkQSB6VodjdHQG 8AKNqchKeU+gKJ9+0+8KGJXdFPGqQ2/bY/samVRd9pJS3ECsZFNsmUVtoo9WL8UDkQth m217owiUGZEXA82iGjVUNXwNwVo32SmvVRrv5CjbxuX7sSUtheWVlFohEXiwNe2OWi9p yl8Q== 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=ccHozR1xmV0cd1VEH0bCLETUheTW3qUIJJyFJeN4SBg=; b=KwqB/0pmycOGVQtcHcL4y/PAoZOo5jyXM5LKk1yqdETPDww2nioykNWNESnPOslb7G XOrKfLo9fazG2sOXmCuon2iBTZOuQKdnjS5nxVHTbsFVnfc7cD/+7d8MXerHBHjc47GU y0b3sj7FvROnjzmuTHa718FhsOo+F9ja4FDjUaWu2wkmAGs9+G4XMonZF1sLIx4qrsC5 x4FuZLM4+mLkmHT9M4/56qvdAt+lB3Taekq0REUJ2Kyj8f0r6uNikhjxNxG/J+wUc88f AkyhSjyzuZTvDPffu+k30vcdpq0/MLX7Pn1WeSkhd882ArOSy+db7awRNLjJdHZSh+xk 787g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hjPm5iDy; 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; 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 s7si9409521ejd.28.2021.08.06.01.24.49; Fri, 06 Aug 2021 01:25:15 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hjPm5iDy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243910AbhHFIWt (ORCPT + 99 others); Fri, 6 Aug 2021 04:22:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:50684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243725AbhHFITn (ORCPT ); Fri, 6 Aug 2021 04:19:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FB61611C9; Fri, 6 Aug 2021 08:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628237967; bh=M7pAnftMKUCRIxOpK5wdnlnvAQSiHACpEAV+cSxhRhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjPm5iDylX3bWJf5+V0jjDODvQ18h5J5vo9ZiespHlflBhQEhio0wBQtZegdS/A45 DmngZoK3syE/gF4dYPu6uSd2TqNKd/3tK6QkgclLLkC9ww0P07kaBtb0sowPAj/anD FyrXFRbdQ4ASR4MY2Vjx1QtyY4t+he7otbVUUaPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Cristian Marussi , Sudeep Holla Subject: [PATCH 5.10 22/30] firmware: arm_scmi: Ensure drivers provide a probe function Date: Fri, 6 Aug 2021 10:17:00 +0200 Message-Id: <20210806081113.880138462@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210806081113.126861800@linuxfoundation.org> References: <20210806081113.126861800@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -113,6 +113,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;