[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1668935315-40471-1-git-send-email-zhangchangzhong@huawei.com>
Date: Sun, 20 Nov 2022 17:08:35 +0800
From: Zhang Changzhong <zhangchangzhong@...wei.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Won Kang <wkang77@...il.com>
CC: Zhang Changzhong <zhangchangzhong@...wei.com>,
<linux-staging@...ts.linux.dev>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] staging: gdm724x: fix potential memleak in register_lte_device()
The register_lte_device() forgets to free the current netdev in case of
register_netdev() fails, add free_netdev() to fix it.
Compile tested only.
Fixes: 61e121047645 ("staging: gdm7240: adding LTE USB driver")
Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
---
drivers/staging/gdm724x/gdm_lte.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c
index 671ee88..34ac9e0 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -905,8 +905,10 @@ int register_lte_device(struct phy_dev *phy_dev,
SET_NETDEV_DEVTYPE(net, &wwan_type);
ret = register_netdev(net);
- if (ret)
+ if (ret) {
+ free_netdev(net);
goto err;
+ }
netif_carrier_on(net);
--
2.9.5
Powered by blists - more mailing lists