Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1875948ybm; Thu, 23 May 2019 08:02:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5g6w9Zcy4cDet2ZygoQg15DoR1aLJi8PeZrP0+aTfqwK52KsDNUyd3PdM/KhR31r12AMw X-Received: by 2002:a17:90a:2e87:: with SMTP id r7mr1786914pjd.121.1558623751937; Thu, 23 May 2019 08:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558623751; cv=none; d=google.com; s=arc-20160816; b=ifj32yCENS7av/2jFOPbtt5NU38t4JzAw3UfhLTunlPlNiggF+Z9pmM1tyxFW7Xbka x2tIwjYnq65mARcITEd675SHbHvh3qCXgriT1yAeBvZ1GVJptXBgwGpAL3kO8iuoEAxs OnqDPHF0s1mjrmNkAVOq7HiKUC558YKRcE9Do99WucrcT4tP8rB9EFdcfDLn5sjoq0QH +hPXwVGl4KZBZOKa/nwnF8SlmYMd1bejQMW/bJ2ilu2XWJdqx1PyavhtPtEse7t/vDF8 xBajXORAx4kLEoiq4clCqIoq7IP/SBEcqGba3Z7CZ+5fels5DGkYruPsYG36J/hND/3W 6q5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=8gX1bNJQcLhWyvCuuWxSXdw+ny/xDHP82M8q1RtGFs4=; b=cfgLbZOivhBs8IHfLezHmEF+MSci77oW7cm7s+h8j8LwLJg/gg7deBtkNkdikx1fKC AMHi7aXI2eShKa3bqKT/v3VoCl7zIznj4iIyXlgyDZkJlbf/HoIYqvWcjNy/2HJ1QFgO TESgjlkWLJmbHyR4/zeuki/OKlK+LS/NHIuupjjusrVzARsg+v4jYzESJdthfbzgyqiZ 3i2/1AFaWjT3ukS4iTBaxpaLd0yS7rWtucxb0wlGnB4/x28GhPXOeoktr7mNLXyED308 g2vBgX6fbUowIjGp9VjP6pQs3SYYWJojCb//I6TvQtjDA9G9rKVw/fLLvG0QokIj/Nhc oigg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=WtzwBrSH; dkim=pass header.i=@codeaurora.org header.s=default header.b=WtzwBrSH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si26815603pla.224.2019.05.23.08.02.14; Thu, 23 May 2019 08:02:31 -0700 (PDT) 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; dkim=pass header.i=@codeaurora.org header.s=default header.b=WtzwBrSH; dkim=pass header.i=@codeaurora.org header.s=default header.b=WtzwBrSH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731044AbfEWPA1 (ORCPT + 99 others); Thu, 23 May 2019 11:00:27 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47866 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730741AbfEWPA0 (ORCPT ); Thu, 23 May 2019 11:00:26 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DB79160A42; Thu, 23 May 2019 15:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1558623625; bh=xjX2dCoX++xPQ70yBZuiq+wW8s0TyrMClqMEGpholq0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WtzwBrSHxC98Nc3KswSuxRp1VN96Pmu74SOXVvvNAXqNaFFA2OJmPaF9ZaCn0RNll /Y3aTKxSGn3pEcG90HsoI6OGjtd4ueW38oJ+zOOLvRlaTP80VT2CSWsV5Gv4qw+fM5 apiqSik983/sk2+OlO6xpJUl3XsqIRazum3T2GDY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from potku.adurom.net (88-114-240-156.elisa-laajakaista.fi [88.114.240.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2B4ED607B9; Thu, 23 May 2019 15:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1558623625; bh=xjX2dCoX++xPQ70yBZuiq+wW8s0TyrMClqMEGpholq0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WtzwBrSHxC98Nc3KswSuxRp1VN96Pmu74SOXVvvNAXqNaFFA2OJmPaF9ZaCn0RNll /Y3aTKxSGn3pEcG90HsoI6OGjtd4ueW38oJ+zOOLvRlaTP80VT2CSWsV5Gv4qw+fM5 apiqSik983/sk2+OlO6xpJUl3XsqIRazum3T2GDY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2B4ED607B9 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Gen Zhang Cc: eyalreizer@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: Re: [PATCH v2] sdio: Fix a memory leaking bug in wl1271_probe() References: <20190523144425.GA26766@zhanggen-UX430UQ> Date: Thu, 23 May 2019 18:00:21 +0300 In-Reply-To: <20190523144425.GA26766@zhanggen-UX430UQ> (Gen Zhang's message of "Thu, 23 May 2019 22:44:25 +0800") Message-ID: <87d0k9b4hm.fsf@kamboji.qca.qualcomm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org + linux-wireless Gen Zhang writes: > In wl1271_probe(), 'glue->core' is allocated by platform_device_alloc(), > when this allocation fails, ENOMEM is returned. However, 'pdev_data' > and 'glue' are allocated by devm_kzalloc() before 'glue->core'. When > platform_device_alloc() returns NULL, we should also free 'pdev_data' > and 'glue' before wl1271_probe() ends to prevent leaking memory. > > Similarly, we should free 'pdev_data' when 'glue' is NULL. And we > should free 'pdev_data' and 'glue' when 'ret' is error. > > Further, we shoulf free 'glue->dev', 'pdev_data' and 'glue' when this > function normally ends to prevent memory leaking. > > Signed-off-by: Gen Zhang > --- > diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c > index 4d4b0770..232ce5f 100644 > --- a/drivers/net/wireless/ti/wlcore/sdio.c > +++ b/drivers/net/wireless/ti/wlcore/sdio.c You need to CC linux-wireless, otherwise patchwork won't see the patch and it will not be applied. Also you should use prefix "wlcore:". https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#commit_title_is_wrong -- Kalle Valo