Message ID | 20221119051900.1192401-1-william.xuanziyang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp564523wrr; Fri, 18 Nov 2022 21:22:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf70pU17YoaIsowB5jbGoYvLGxGNLktccroXekT2WlvomJvDnJh+zqkFyGWIe5o/1yORRPBK X-Received: by 2002:a17:906:1e83:b0:78d:addf:67c3 with SMTP id e3-20020a1709061e8300b0078daddf67c3mr84864ejj.253.1668835333479; Fri, 18 Nov 2022 21:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668835333; cv=none; d=google.com; s=arc-20160816; b=Y/vmHeoMsJ/EWKwVRnkk40IxLffgkbdqKSqbzz1Bmg3VQIkwV5gBUlNoE3YOouBEfw B/5iqr1htOaiC0pl8cF0+2XknPCXgN2rr2qXveaAvM5mCR4Ch1Hd7Da5GKDvA6BKc3BT pu8z/bqclQi0DVR04YYjbgGWSd3kaX0eLFCgzEAT6ckMI8OgKmt7Z3elbZ7NQtUbIUSg n78yCYVyLnka4av/vF8yB9zY0cxD3UwO2aNlGO2os0B17FLevxqyMH1l6EWsl89LLfB3 F+vhyupFmkih4p10q6rbH7zyRwWSsLHazql+eRlYH19muMdAFXcKskO2QDwdlY+cPuK7 Pirg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=2GzB/kmq+dVb27MVZRXw1yfPn6PZIA3KoodU7lA3d1c=; b=b4OMREi8RH1Zv8UF6vXj9sqtWlNonT6TwT/764BzuLbCcVLVYHAeQYKLH5yKX4kmB5 mwOb5Lewsl56cymE9Iy+ps546oQLOmPl08Ri7giTgraqU+QV1u/IqcRs+XM9aAmIRs91 hQ3ItxPeh+xV4PwpqqIkUSGWQYgbL6mNhiH8wzm+kW4twsaUBTicoNRc4pL9tqBN+u47 86ZEAKS8cNTuxl0LPvJR26f+cnly6bvoT5qhERDXzSyB5+ChR1sphUb57ZZLFNgJWZSb IsvmKNEdEahOhFJ1Y4fihqYkT/WQ60YurPeiCGmjYP+I1/hzyVh+u4cF48nxu1O6TBMP +Dzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a1709065d0300b0073866c0672asi6156506ejt.73.2022.11.18.21.21.49; Fri, 18 Nov 2022 21:22:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbiKSFTM (ORCPT <rfc822;kkmonlee@gmail.com> + 99 others); Sat, 19 Nov 2022 00:19:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiKSFTJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 19 Nov 2022 00:19:09 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FBB86D491; Fri, 18 Nov 2022 21:19:07 -0800 (PST) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NDhgs2spmzFqQ8; Sat, 19 Nov 2022 13:15:53 +0800 (CST) Received: from localhost.localdomain (10.175.104.82) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 19 Nov 2022 13:19:04 +0800 From: Ziyang Xuan <william.xuanziyang@huawei.com> To: <srini.raju@purelifi.com>, <kvalo@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <linux-wireless@vger.kernel.org>, <netdev@vger.kernel.org> CC: <linux-kernel@vger.kernel.org> Subject: [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx() Date: Sat, 19 Nov 2022 13:19:00 +0800 Message-ID: <20221119051900.1192401-1-william.xuanziyang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.82] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749900678736117773?= X-GMAIL-MSGID: =?utf-8?q?1749900678736117773?= |
Series |
[net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
|
|
Commit Message
Ziyang Xuan
Nov. 19, 2022, 5:19 a.m. UTC
urbs does not be freed in exception paths in __lf_x_usb_enable_rx().
That will trigger memory leak. To fix it, add kfree() for urbs within
"error" label. Compile tested only.
Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
drivers/net/wireless/purelifi/plfxlc/usb.c | 1 +
1 file changed, 1 insertion(+)
Comments
Ziyang Xuan <william.xuanziyang@huawei.com> writes: > urbs does not be freed in exception paths in __lf_x_usb_enable_rx(). > That will trigger memory leak. To fix it, add kfree() for urbs within > "error" label. Compile tested only. > > Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices") > Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> > --- > drivers/net/wireless/purelifi/plfxlc/usb.c | 1 + > 1 file changed, 1 insertion(+) plfxlc patches go to wireless tree, not net. But I think I'll take this to wireless-next actually.
> Ziyang Xuan <william.xuanziyang@huawei.com> writes: > >> urbs does not be freed in exception paths in __lf_x_usb_enable_rx(). >> That will trigger memory leak. To fix it, add kfree() for urbs within >> "error" label. Compile tested only. >> >> Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices") >> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> >> --- >> drivers/net/wireless/purelifi/plfxlc/usb.c | 1 + >> 1 file changed, 1 insertion(+) > > plfxlc patches go to wireless tree, not net. But I think I'll take this > to wireless-next actually. OK, thanks. >
Ziyang Xuan <william.xuanziyang@huawei.com> wrote: > urbs does not be freed in exception paths in __lf_x_usb_enable_rx(). > That will trigger memory leak. To fix it, add kfree() for urbs within > "error" label. Compile tested only. > > Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices") > Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> Patch applied to wireless-next.git, thanks. 895b3b06efc2 wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c index 39e54b3787d6..76d0a778636a 100644 --- a/drivers/net/wireless/purelifi/plfxlc/usb.c +++ b/drivers/net/wireless/purelifi/plfxlc/usb.c @@ -247,6 +247,7 @@ static int __lf_x_usb_enable_rx(struct plfxlc_usb *usb) for (i = 0; i < RX_URBS_COUNT; i++) free_rx_urb(urbs[i]); } + kfree(urbs); return r; }