From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4F4EC43219 for ; Mon, 14 Nov 2022 13:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237680AbiKNNCq (ORCPT ); Mon, 14 Nov 2022 08:02:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237724AbiKNNCp (ORCPT ); Mon, 14 Nov 2022 08:02:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0E4729813 for ; Mon, 14 Nov 2022 05:02:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F64E61175 for ; Mon, 14 Nov 2022 13:02:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40F09C433B5; Mon, 14 Nov 2022 13:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668430962; bh=yCN/iiM1viNY8rYVxmWJp3Gq4iYKURvbmIjrk1MpCVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uJ/m16m4MzQFA1jZRzMhXAtdb6C4REN6LxqYaecbG9BQC+FJcS5XxhPtJaCaOYhGB cIEIxGglWeMo9SZ5d+79Ve+2qlAEqNh9i86QU1wyMtMRpjRZ6pu5zV9vbsM1zWZ7QN 0/mNY8fjg96yvFrhcYwmAhZYyDMuFXN3Xt7KCyrs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, HW He , Loic Poulain , Zhaoping Shu , "David S. Miller" , Sasha Levin Subject: [PATCH 6.0 050/190] net: wwan: iosm: fix memory leak in ipc_wwan_dellink Date: Mon, 14 Nov 2022 13:44:34 +0100 Message-Id: <20221114124500.981834002@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114124458.806324402@linuxfoundation.org> References: <20221114124458.806324402@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: HW He [ Upstream commit f25caaca424703d5a0607310f0452f978f1f78d9 ] IOSM driver registers network device without setting the needs_free_netdev flag, and does NOT call free_netdev() when unregisters network device, which causes a memory leak. This patch sets needs_free_netdev to true when registers network device, which makes netdev subsystem call free_netdev() automatically after unregister_netdevice(). Fixes: 2a54f2c77934 ("net: iosm: net driver") Signed-off-by: HW He Reviewed-by: Loic Poulain Signed-off-by: Zhaoping Shu Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/wwan/iosm/iosm_ipc_wwan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wwan/iosm/iosm_ipc_wwan.c b/drivers/net/wwan/iosm/iosm_ipc_wwan.c index 4712f01a7e33..3d70b34f96e3 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_wwan.c +++ b/drivers/net/wwan/iosm/iosm_ipc_wwan.c @@ -168,6 +168,7 @@ static void ipc_wwan_setup(struct net_device *iosm_dev) iosm_dev->max_mtu = ETH_MAX_MTU; iosm_dev->flags = IFF_POINTOPOINT | IFF_NOARP; + iosm_dev->needs_free_netdev = true; iosm_dev->netdev_ops = &ipc_inm_ops; } -- 2.35.1