From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88AF5C4332F for ; Sun, 26 Dec 2021 16:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232871AbhLZQ4O (ORCPT ); Sun, 26 Dec 2021 11:56:14 -0500 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:56381 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbhLZQ4N (ORCPT ); Sun, 26 Dec 2021 11:56:13 -0500 Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id 1WoWnyraJ3ptZ1WoXnZEua; Sun, 26 Dec 2021 17:56:12 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 26 Dec 2021 17:56:12 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, eajames@linux.ibm.com, andrew@aj.id.au, gregkh@linuxfoundation.org Cc: linux-fsi@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] fsi: Aspeed: Fix a potential double free Date: Sun, 26 Dec 2021 17:56:02 +0100 Message-Id: <2cafa0607ca171ebd00ac6c7e073b46808e24f00.1640537669.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'aspeed' is a devm_alloc'ed, so there is no need to free it explicitly or there will be a double free(). Remove the 'release' function that is wrong and unneeded. Fixes: 606397d67f41 ("fsi: Add ast2600 master driver") Signed-off-by: Christophe JAILLET --- This patch is completely theoretical. It looks good to me, but there is a little too much indirections for me. I'm also not that familiar with fixing issue related to 'release' function... ... So review with care :) --- drivers/fsi/fsi-master-aspeed.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 8606e55c1721..4a745ccb60cf 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -373,14 +373,6 @@ static int aspeed_master_break(struct fsi_master *master, int link) return aspeed_master_write(master, link, 0, addr, &cmd, 4); } -static void aspeed_master_release(struct device *dev) -{ - struct fsi_master_aspeed *aspeed = - to_fsi_master_aspeed(dev_to_fsi_master(dev)); - - kfree(aspeed); -} - /* mmode encoders */ static inline u32 fsi_mmode_crs0(u32 x) { @@ -603,7 +595,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) dev_info(&pdev->dev, "hub version %08x (%d links)\n", reg, links); aspeed->master.dev.parent = &pdev->dev; - aspeed->master.dev.release = aspeed_master_release; aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); aspeed->master.n_links = links; -- 2.32.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9916C433F5 for ; Sun, 26 Dec 2021 16:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=J24VPyzFPjZq6ZXTDZ5RM2c7rBKPtWJPUoCLN6XWoPo=; b=PJ7AmljphJ8YRg oIOn9KyhdkdmU1G8i9mU8oLWuAvG5sdHfimjO9TzoPlOM4JB4USC5lcESsVT1HQwc1f5t57auxTCq Q4S17KsRF3Wf6pLCZSgTZPxqZdIn5XrV7RqWJiAl9KLd5LfPpKoU+dlYF4+C8PWTcyeVjyJkNQK9w wF5G3yd90lTKAfQVpy+OpgcSyhbdVfd8gF1Fxnid1K009vrHd5FbBe8h5P8mFXXN7i1cVt4yejFPp i31rsPQIapKuS7R6jH+GEI2vpypi9OWVGZzgwvR3nT3C/2lSmTaMw8B5LsLBYZGrxSZEAkF6aFejT O4nUn9rwbcvAtC0gmoCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1Wop-00FhIH-PN; Sun, 26 Dec 2021 16:56:23 +0000 Received: from smtp10.smtpout.orange.fr ([80.12.242.132] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n1Wol-00FhGZ-E5 for linux-arm-kernel@lists.infradead.org; Sun, 26 Dec 2021 16:56:21 +0000 Received: from pop-os.home ([86.243.171.122]) by smtp.orange.fr with ESMTPA id 1WoWnyraJ3ptZ1WoXnZEua; Sun, 26 Dec 2021 17:56:12 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 26 Dec 2021 17:56:12 +0100 X-ME-IP: 86.243.171.122 From: Christophe JAILLET To: jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, eajames@linux.ibm.com, andrew@aj.id.au, gregkh@linuxfoundation.org Cc: linux-fsi@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] fsi: Aspeed: Fix a potential double free Date: Sun, 26 Dec 2021 17:56:02 +0100 Message-Id: <2cafa0607ca171ebd00ac6c7e073b46808e24f00.1640537669.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211226_085619_684553_2979635B X-CRM114-Status: UNSURE ( 9.15 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 'aspeed' is a devm_alloc'ed, so there is no need to free it explicitly or there will be a double free(). Remove the 'release' function that is wrong and unneeded. Fixes: 606397d67f41 ("fsi: Add ast2600 master driver") Signed-off-by: Christophe JAILLET --- This patch is completely theoretical. It looks good to me, but there is a little too much indirections for me. I'm also not that familiar with fixing issue related to 'release' function... ... So review with care :) --- drivers/fsi/fsi-master-aspeed.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/fsi/fsi-master-aspeed.c b/drivers/fsi/fsi-master-aspeed.c index 8606e55c1721..4a745ccb60cf 100644 --- a/drivers/fsi/fsi-master-aspeed.c +++ b/drivers/fsi/fsi-master-aspeed.c @@ -373,14 +373,6 @@ static int aspeed_master_break(struct fsi_master *master, int link) return aspeed_master_write(master, link, 0, addr, &cmd, 4); } -static void aspeed_master_release(struct device *dev) -{ - struct fsi_master_aspeed *aspeed = - to_fsi_master_aspeed(dev_to_fsi_master(dev)); - - kfree(aspeed); -} - /* mmode encoders */ static inline u32 fsi_mmode_crs0(u32 x) { @@ -603,7 +595,6 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) dev_info(&pdev->dev, "hub version %08x (%d links)\n", reg, links); aspeed->master.dev.parent = &pdev->dev; - aspeed->master.dev.release = aspeed_master_release; aspeed->master.dev.of_node = of_node_get(dev_of_node(&pdev->dev)); aspeed->master.n_links = links; -- 2.32.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel