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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41060C433FE for ; Wed, 27 Oct 2021 07:32:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 270FD60F9B for ; Wed, 27 Oct 2021 07:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240505AbhJ0HfL (ORCPT ); Wed, 27 Oct 2021 03:35:11 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:21084 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240489AbhJ0HfJ (ORCPT ); Wed, 27 Oct 2021 03:35:09 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1635319965; h=Date: Message-ID: Cc: To: References: In-Reply-To: From: Subject: Content-Transfer-Encoding: MIME-Version: Content-Type: Sender; bh=O93Caq1JW1KMAEIKVZ6rP7UqQ9VTvsuojA8a/yFs0ZU=; b=is+08FVc0R32WshlfGY/WThGLINxnkTKyxyiHgCb2tagTekpyJfueclBrfuE7+2MuwFEiodl okii+a/78Xvoy15jXDHGSby819Zk6d4ABXm/iUSGASkpCa/T8biAwfbxwjnZpwkiOTYfxzSj kImy2KXjy39ld/niZZoKihWoqHc= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 617900995ca800b6c1c5fff2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Wed, 27 Oct 2021 07:32:41 GMT Sender: kvalo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 13DB4C4361B; Wed, 27 Oct 2021 07:32:41 +0000 (UTC) Received: from tykki.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0F3F1C4338F; Wed, 27 Oct 2021 07:32:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 0F3F1C4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2 wireless-drivers 1/2] libertas_tf: Fix possible memory leak in probe and disconnect From: Kalle Valo In-Reply-To: <20211020120345.2016045-2-wanghai38@huawei.com> References: <20211020120345.2016045-2-wanghai38@huawei.com> To: Wang Hai Cc: , , , , , , , , , , User-Agent: pwcli/0.1.0-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <163531995539.30745.14828002876650574898.kvalo@codeaurora.org> Date: Wed, 27 Oct 2021 07:32:41 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wang Hai wrote: > I got memory leak as follows when doing fault injection test: > > unreferenced object 0xffff88810a2ddc00 (size 512): > comm "kworker/6:1", pid 176, jiffies 4295009893 (age 757.220s) > hex dump (first 32 bytes): > 00 50 05 18 81 88 ff ff 00 00 00 00 00 00 00 00 .P.............. > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > backtrace: > [] slab_post_alloc_hook+0x9c/0x490 > [] kmem_cache_alloc_trace+0x1f7/0x470 > [] if_usb_probe+0x60/0x37c [libertas_tf_usb] > [] usb_probe_interface+0x1aa/0x3c0 [usbcore] > [] really_probe+0x190/0x480 > [] __driver_probe_device+0xf9/0x180 > [] driver_probe_device+0x53/0x130 > [] __device_attach_driver+0x105/0x130 > [] bus_for_each_drv+0x129/0x190 > [] __device_attach+0x1c9/0x270 > [] device_initial_probe+0x20/0x30 > [] bus_probe_device+0x142/0x160 > [] device_add+0x829/0x1300 > [] usb_set_configuration+0xb01/0xcc0 [usbcore] > [] usb_generic_driver_probe+0x6e/0x90 [usbcore] > [] usb_probe_device+0x6f/0x130 [usbcore] > > cardp is missing being freed in the error handling path of the probe > and the path of the disconnect, which will cause memory leak. > > This patch adds the missing kfree(). > > Fixes: c305a19a0d0a ("libertas_tf: usb specific functions") > Reported-by: Hulk Robot > Signed-off-by: Wang Hai 2 patches applied to wireless-drivers-next.git, thanks. d549107305b4 libertas_tf: Fix possible memory leak in probe and disconnect 9692151e2fe7 libertas: Fix possible memory leak in probe and disconnect -- https://patchwork.kernel.org/project/linux-wireless/patch/20211020120345.2016045-2-wanghai38@huawei.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches