Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1519833rwb; Fri, 18 Nov 2022 21:22:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ZB7hQlWvX0Pz65Tzpz8lz9l86bp7NmMF+d5fnBl82jZoNfE2iNDe6c0wwhm0dy72+jy6v X-Received: by 2002:a17:907:6d12:b0:7b2:bb8c:5398 with SMTP id sa18-20020a1709076d1200b007b2bb8c5398mr4122511ejc.573.1668835321412; Fri, 18 Nov 2022 21:22:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668835321; cv=none; d=google.com; s=arc-20160816; b=zKEHYOBSDXkEHE0FFoEujSz4gqx5S19vH1p4KO1wgntJvuLUfVIsJgaufr4py+ErUt HBkjq6lKaCqtA07uSZc8aaGHEITrdVrPXZSUIb/U0bvt3mbRdDwITct7POHVQ9N8Idjk GTvJ1PPdh9TrXWR4mOFLnNJMp0u1DfFIS2chwol/tkpiHTATNjzy4PJNvcqTQdlDlphV 9/SKrD4AUdJF1b2GD73fJCAXMa8eOcAZBLGbtbVXxiNp7ZGMR465BXuAXefgjvcbijqw jMxMCYKJowBMAGgdtqOkiZW87/Hg8EK4qpP0xphho5xSRy3m2zqA7Um5E5dVW7QrBpfN g/Qw== 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=dWy4PVWS1GTHcJEs3RU+vN1KJfE61elrHRl7ptvg5paZpgoOFDZJ69wlwYUu6vUzqt 0QvVw4IE88dgKOx9OBsYoa1960nKw2GwVIGFGiZnVSDwD+NUP9qDdWrdZOatSZTidVox MC2m8b7ZIzQyorjmxJ7G+GKEeLnLyYHIcyKloCCcfpvUzuRiCCaYLbavRkfY2hwlArg9 XCaaYbaMhjsnYDsjn4SddDt9UmUT8rom3Abd6l+QEw9Yp/YazNIVZdYo04QVE+AuvW/c Kk2KV2XmGkHkLWLZdAoalXhMmCfi++UdQixx8YXPZHNTh7XduxqZNrHNC8avAEK6dRPR 2mrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh13-20020a170906da8d00b007ae4c686a4dsi4125559ejb.649.2022.11.18.21.21.41; Fri, 18 Nov 2022 21:22:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S231566AbiKSFTK (ORCPT + 68 others); Sat, 19 Nov 2022 00:19:10 -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 ); 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 To: , , , , , , , CC: 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: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- drivers/net/wireless/purelifi/plfxlc/usb.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.25.1