Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3030985pxb; Mon, 18 Oct 2021 06:58:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzis+zhCDY1QCHs2uVHV7pmFc1icit0C+ncu9z9ae3HAiV6orF1aPv2TlKOshAxqCjyzEIp X-Received: by 2002:a17:902:f281:b0:13f:3be8:b160 with SMTP id k1-20020a170902f28100b0013f3be8b160mr27474184plc.32.1634565505289; Mon, 18 Oct 2021 06:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634565505; cv=none; d=google.com; s=arc-20160816; b=dbbvgAl0chnQDQlDtMm3gTMIDtxh+AbBHZ7ZDuzIL1hl1viDS6ELbZ2LzzIGRJPcXK mweVKX8vzBxtd++2eCAYgIuyfbjm43qbUpQfuBq9nLS83B0DI6UcphhJ5ywUqjsENqDX trxjR3VIFezys7xiEfg4vykKk8WbmifwORQiuLaiHX7MEG9y3HxoFBGKceFRVYvRrw4b 4MM9bm9BV1XIlzQ2/CnLGx6A0t+j0/jN74CS6Y9S0WPZJX1uu4u4ZjEJ3ZAUWsFmBNv+ iSBL72h+k3qebTjAiJ+PZoDygHkke7kxFTnoi1qnpOVVtFRHRtMlIZR3+SmY3oulKArw kLTw== 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=YIOR6Tavg5nWp/y15x9E0uxeK+JF7ot38r/xe/vw/zo=; b=DZjVEUAm5UP4qm+t24D/c/uhVeIoMwueriftoU5Swj45GZBx5E6kJDgqiVwuaIBC1s SIgoi2y+UcKDc8FMZpNNJs8kzgU0C2zPW7pUUZc38Pe79J6gdUAOqW/mfEQcas0ImNS5 P6XUJPI5MEkEBeNxm5b5eHBYVqZbelExGkhgBL+xXyut7AGgohV2MvZnEXOmA2KP3uT+ pRmckEyI5ZJdbkcSVDLa9kmms9tXOIFsdmlQKSdCZVabDO5QT0oLFwWgfCEjXxeebSLQ iSCF29juM+6vpyBcY4m6/YcG3HlGn94kCD8thVsKlA3sL0YTlKScDsNQi4oXC2z+XMSt /Yew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rGmyO7pT; 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 h5si18243113pls.167.2021.10.18.06.58.10; Mon, 18 Oct 2021 06:58:25 -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=rGmyO7pT; 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 S232554AbhJRN7T (ORCPT + 99 others); Mon, 18 Oct 2021 09:59:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:57670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbhJRN5P (ORCPT ); Mon, 18 Oct 2021 09:57:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B41AC61352; Mon, 18 Oct 2021 13:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634564449; bh=xilPZk9/nZia+eYlSf6R1c5WQTZjPZOxSrt8QTci9yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGmyO7pTaPFhQvbyrMzRAaStFXjpnMFCzToAb6/oWOT60xtefFzSjU/+izfdoELRB nnHnrml3BvyF5aA1Ivf+1P1EARMkXe6mdU+2qsq9RBzkkPfKZSRy/lh7sHlWTBzFBt p6h+SoudwotFC4RnGyv1b3PJiyN/AFGDlJXtDetw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Wiklander , Sudeep Holla Subject: [PATCH 5.14 093/151] firmware: arm_ffa: Add missing remove callback to ffa_bus_type Date: Mon, 18 Oct 2021 15:24:32 +0200 Message-Id: <20211018132343.706120091@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132340.682786018@linuxfoundation.org> References: <20211018132340.682786018@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 244f5d597e1ea519c2085fbd9819458688775e42 upstream. Currently the arm_ffa firmware driver can be built as module and hence all the users of FFA driver. If any driver on the ffa bus is removed or unregistered, the remove callback on all the device bound to the driver being removed should be callback. For that to happen, we must register a remove callback on the ffa_bus which is currently missing. This results in the probe getting called again without the previous remove callback on a device which may result in kernel crash. Fix the issue by registering the remove callback on the FFA bus. Link: https://lore.kernel.org/r/20210924092859.3057562-1-sudeep.holla@arm.com Fixes: e781858488b9 ("firmware: arm_ffa: Add initial FFA bus support for device enumeration") Reported-by: Jens Wiklander Tested-by: Jens Wiklander Signed-off-by: Sudeep Holla Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/arm_ffa/bus.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/firmware/arm_ffa/bus.c +++ b/drivers/firmware/arm_ffa/bus.c @@ -49,6 +49,13 @@ static int ffa_device_probe(struct devic return ffa_drv->probe(ffa_dev); } +static void ffa_device_remove(struct device *dev) +{ + struct ffa_driver *ffa_drv = to_ffa_driver(dev->driver); + + ffa_drv->remove(to_ffa_dev(dev)); +} + static int ffa_device_uevent(struct device *dev, struct kobj_uevent_env *env) { struct ffa_device *ffa_dev = to_ffa_dev(dev); @@ -86,6 +93,7 @@ struct bus_type ffa_bus_type = { .name = "arm_ffa", .match = ffa_device_match, .probe = ffa_device_probe, + .remove = ffa_device_remove, .uevent = ffa_device_uevent, .dev_groups = ffa_device_attributes_groups, };