Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1517571ybl; Mon, 2 Dec 2019 04:42:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzavxWI/YNvpP1S5c3DuJf3u0mwsGS4isf5IUjjl6v06Mih9vMx49MHgR037uuPD6RvdM03 X-Received: by 2002:a05:6402:17a7:: with SMTP id j7mr24022710edy.8.1575290551435; Mon, 02 Dec 2019 04:42:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575290551; cv=none; d=google.com; s=arc-20160816; b=q3kNyrb5OZtUqi+cOyyoMCRdWHHc9AAC7GHSOJnwdlx5v0zmv2ie425x+xL7rdduPU 3hF2e2CCMjZDu8pzGa4PPoHTGcBrG+JcfDUxb++aOUj7NZS8rBZBgcC0Gbp8T/D4QUiJ udfZ/EX4dUCxL9BQbPfXtkOgU00Wg97wtVumK2TagnLiIiSs1KsQ77e99zPA/8T+Ys1o qL8+xao0nztit2R6jwHqOdQ4WakUG4kzjeWvqNQyaqxxEs0AVAbfrFoRC/lJHhc9VKX0 +mEkThJMs5x618y5ZQJL7QrV4wYoIoa0HlKDEMm4q1OoPYK767XAggPIr0X2uwqLGlq4 zTjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=eAicYXR5yS5bz2d+L2XBbVtzEllU6RD1RsfH7Ugwu48=; b=Wh3SfcMlr4tGA4h2gRA8zoOoLDuzwzO2qmC/mv/JgBIi5H3Wzyn4mzJj4O2QAtt5NN hVG5/YUIDPlLxz54WR+VhxqnKcIQyX3pH0qjgRuQz/r0mPqz2N4WYwlLUMe/Dmlis1up m89PT2QoxWKKFYPmWDaIyG89ER2pz/O/r44Hl0+QR7qcgrtxIrnbdv1hLSM+5ejNPbqw pJGDIdRPuwFkb9TCQL7M5dT6rmVGm26c0SBPbTI4vza2Kl5tywlWfJsgioTCCiQCuDsQ 074prAFugZxPO2stG5xXZgYOXrlxFTi3f7lAc9ixHhr6I8E8IwWsLYHkIO4UG6X57cBe ze3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot29si7184068ejb.129.2019.12.02.04.42.05; Mon, 02 Dec 2019 04:42:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727408AbfLBMkp (ORCPT + 99 others); Mon, 2 Dec 2019 07:40:45 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:58717 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbfLBMkp (ORCPT ); Mon, 2 Dec 2019 07:40:45 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1ibl0L-0000Rr-2B; Mon, 02 Dec 2019 13:40:41 +0100 To: Daode Huang Subject: Re: [PATCH] irqchip/stm32: Fix "WARNING: invalid free of =?UTF-8?Q?devm=5F=20allocated?= X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 02 Dec 2019 12:40:40 +0000 From: Marc Zyngier Cc: , , , , , , , In-Reply-To: <8acaa494701c91b8a8acd60a2390d810@www.loen.fr> References: <1574931880-168682-1-git-send-email-huangdaode@hisilicon.com> <8acaa494701c91b8a8acd60a2390d810@www.loen.fr> Message-ID: <028744c349410eb1f74b7e2b18590c75@www.loen.fr> X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: huangdaode@hisilicon.com, jason@lakedaemon.net, linux-kernel@vger.kernel.org, fabien.dessenne@st.com, mcoquelin.stm32@gmail.com, tglx@linutronix.de, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-12-02 12:29, Marc Zyngier wrote: > On 2019-11-28 09:04, Daode Huang wrote: >> Since devm_ allocated data can be automaitcally released, it's no >> need to free it apparently, just remove it. >> >> Fixes: cfbf9e497094 ("irqchip/stm32: Use a platform driver for >> stm32mp1-exti device") >> Signed-off-by: Daode Huang >> --- >> drivers/irqchip/irq-stm32-exti.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/drivers/irqchip/irq-stm32-exti.c >> b/drivers/irqchip/irq-stm32-exti.c >> index e00f2fa..46ec0af 100644 >> --- a/drivers/irqchip/irq-stm32-exti.c >> +++ b/drivers/irqchip/irq-stm32-exti.c >> @@ -779,8 +779,6 @@ static int __init stm32_exti_init(const struct >> stm32_exti_drv_data *drv_data, >> irq_domain_remove(domain); >> out_unmap: >> iounmap(host_data->base); >> - kfree(host_data->chips_data); >> - kfree(host_data); >> return ret; >> } > > Applied, thanks. Scratch that. This patch is just wrong, and just reading the code makes it obvious. stm32_exti_init() is only called on paths that allocate the memory with kmalloc. Clearly you haven't tried to understand what is going on. M. -- Jazz is not dead. It just smells funny...