From patchwork Thu Nov 17 11:36:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Changzhong X-Patchwork-Id: 21579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp344423wrr; Thu, 17 Nov 2022 03:24:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf6AJCP/ylzhzbBSiNAENcG3Wgl9v0C7tm6+yn3YL6E2k5W/WA/7JVipTRyCY2rsGiJYGwFh X-Received: by 2002:a63:564b:0:b0:46f:ed3a:ac42 with SMTP id g11-20020a63564b000000b0046fed3aac42mr1606300pgm.617.1668684268079; Thu, 17 Nov 2022 03:24:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668684268; cv=none; d=google.com; s=arc-20160816; b=tkBLmycpQh9taFkiFBrRA7+1vvrGDMnKHC8y+pNsC5vfleMAj+al2igp/zhT69QLka 09+YT+IOiCUb8fg/u/LblagLsBO/uPnhB5zVKU4MLq3Ta+frWB/lEny9SZzYZ6pb3JGp Qo5xBo1jY+HVEKPNk2zeGmiLPbPUYYC1uHLsXTYvf1tyzx/+r2/E7IFlPf2Pqg1TiFwL FKm6VCYSC4VXSgLykbukw84s3Q1GOEaWIA3lbKM5hJ5tS0QPfTvGrpzSE57Vvi1DKtvW hv/DjWAZdYKoGB9aVybe0aqWqGKyinsvCDzCOC25U37StQUVLk7/DNGdfH1WqiZscD/S cTHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=3ylcVf2JsIWmBTzY7AkVTnaK3PfA42unv7AV0nFAkI4=; b=coZuokZc4PSftYAel2IHqzIWLX7OMgbA5YxPY+9Vpk11Eiq+U2o76Q18soF3s8uNpE R2xmnqxbgMfWBPtfdAICa43RM24YtM7mUB6nmnKBLmDG9KvlzDamgXjihezvnlCD0iqj ox271bCRNSIJzU3CfsEjr/2bazLyaX7J+qVHFTzDxMnGIIOuY9rjJUUK9kRKIMGqFy6m jpNGhWJnbMh4wj+cLKNzFqBDeY9dGGC4vKfGK0TnUo3hN3KtCfDnlzkZ5BryOst9Qxu7 G5Cdjd8WK946Or4O23TW7dUnZCF2jh8SJMuF/kuMwiVPn08iFF9sXS7mZnXQ0MZJKGaz 367g== 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 h2-20020a17090a580200b00202c7f4631esi4226089pji.19.2022.11.17.03.24.15; Thu, 17 Nov 2022 03:24:28 -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 S239600AbiKQLPy (ORCPT + 99 others); Thu, 17 Nov 2022 06:15:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239501AbiKQLPv (ORCPT ); Thu, 17 Nov 2022 06:15:51 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF00B02; Thu, 17 Nov 2022 03:15:50 -0800 (PST) Received: from dggpeml500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NCclc674WzmVxB; Thu, 17 Nov 2022 19:15:24 +0800 (CST) Received: from dggpeml500006.china.huawei.com (7.185.36.76) by dggpeml500020.china.huawei.com (7.185.36.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 19:15:48 +0800 Received: from localhost.localdomain (10.175.112.70) by dggpeml500006.china.huawei.com (7.185.36.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 17 Nov 2022 19:15:47 +0800 From: Zhang Changzhong To: Ajay Singh , Claudiu Beznea , Kalle Valo , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , Johnny Kim , Greg Kroah-Hartman , Chris Park , Rachel Kim , "Nicolas Ferre" CC: Zhang Changzhong , , , Subject: [PATCH wireless v2] wilc1000: fix potential memory leak in wilc_mac_xmit() Date: Thu, 17 Nov 2022 19:36:03 +0800 Message-ID: <1668684964-48622-1-git-send-email-zhangchangzhong@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.70] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500006.china.huawei.com (7.185.36.76) 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749742275562195331?= X-GMAIL-MSGID: =?utf-8?q?1749742275562195331?= The wilc_mac_xmit() returns NETDEV_TX_OK without freeing skb, add dev_kfree_skb() to fix it. Compile tested only. Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver") Signed-off-by: Zhang Changzhong --- v1->v2: add "Compile tested only" to commit log drivers/net/wireless/microchip/wilc1000/netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c index 9b319a4..6f3ae0d 100644 --- a/drivers/net/wireless/microchip/wilc1000/netdev.c +++ b/drivers/net/wireless/microchip/wilc1000/netdev.c @@ -730,6 +730,7 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *ndev) if (skb->dev != ndev) { netdev_err(ndev, "Packet not destined to this device\n"); + dev_kfree_skb(skb); return NETDEV_TX_OK; }