Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp761877pxb; Wed, 27 Oct 2021 11:54:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqZ1xYCH5seJgpPuaYw6Sc01U1Xd+fN8axrI7UlYRaWwIu7rj5eXgFgN5FeOTFw+CjgVMc X-Received: by 2002:a17:902:d2c5:b0:141:688e:cdcc with SMTP id n5-20020a170902d2c500b00141688ecdccmr5935141plc.37.1635360854178; Wed, 27 Oct 2021 11:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635360854; cv=none; d=google.com; s=arc-20160816; b=0w7ROeRXgLnIkCPDcQwrHm/1heHajOXeIMsZBzVBG2CT+kv6M3PRJR/V6JZo/vqZIo QT+qeE5h/lbFgMRPhmS2988EwckZ7Q1iyNzmrevlK1xG2FHOXf3JPa2knSfLtwFiFsw0 R4JhB8VzkYne4NtKnARmsCOXFpYbVXDjWLs6NS4McmNBQCcD2qVP/dLZZcml7dLgKqhm tyzFC6nmtQPX5+35xd3gX0RvdhNBr/mdpCcB+pRkxHODFrsVPpkIi9QYBwkqAhe2ClRU EPubMUgii5/AeiLdA0r4B0pb66RPUyeIw1PIXepYqzyY4M5muRy/a/EwIfe7YbJvWeAE 9q0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dmarc-filter:sender:dkim-signature; bh=O93Caq1JW1KMAEIKVZ6rP7UqQ9VTvsuojA8a/yFs0ZU=; b=FGbcZpaWycJulfjht1pNe99JzCQ6H8UGOpciimRPK5eMigrq2oqwiB50dcgAAGH5Z3 Jk7znrvX/4sIg+9HzJwLKNMp3Y2tCl2yg6/nO/+6Ur5525VtAUpHsdfOeK3tbZo46lDS bpQKdeiZT7SI+YIUtzc6w8Cx9Rq2jtuAbw/XpuW0MS8cymqnHhIOqShyUDe+oNVswEp4 LyGgFa7pgEgF+assQVyYpvvnmBtTCpcM2au02RQlrZ5CHzdvlDpBoBlVVo9tusz8tlrT qL7d5ouGuB1N+X1cnOu92MDTkoowfele75gu8rAWY7UAhvJsNvcZINutNjrtgcvwdI8w id+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=is+08FVc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id my15si6445123pjb.182.2021.10.27.11.54.04; Wed, 27 Oct 2021 11:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@mg.codeaurora.org header.s=smtp header.b=is+08FVc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240511AbhJ0HfK (ORCPT + 67 others); Wed, 27 Oct 2021 03:35:10 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:34846 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240494AbhJ0HfJ (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: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= 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 617900995ca800b6c1c5fff3 (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) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=2.0 tests=ALL_TRUSTED,BAYES_00, MISSING_DATE,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 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-wireless@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