Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp843249rwb; Fri, 13 Jan 2023 05:01:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDJRtfUyYifnnvPGrchtQ0zlH360/I4ATilANVLmdiA7IdVNwbe78pQ+a19GF77dZmot2i X-Received: by 2002:a17:907:2113:b0:84d:4b39:1448 with SMTP id qn19-20020a170907211300b0084d4b391448mr18062492ejb.67.1673614876801; Fri, 13 Jan 2023 05:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673614876; cv=none; d=google.com; s=arc-20160816; b=Gz6qnr4S4eZiXzqzqkyh3aRxOq6R7SavaENNFEe7sKSxX5SNjglmNUSvlSe9/Rndq4 VnNVTJvL5WcZsqpF8yUjDPvHXgg0l3rhy5U7rZueskobNoDOptALTSGOE7v1//6JDNvz mC9ZxL0neDCwOUXWe2zUegHOkmL9hu3NfZCzj/omTb3NJZ53noSgHdLTBqQXxom/5YYw gVneOJkoemJa83RanJC9SqBCIChZ9WyP9ic13fMemRAUMtdK2sNqiiJ1e4614jJAuqDZ iTrWyUxm5sYUKw6bUGdGM2ZHCDC0bDFS8S4fGHv+3OzN+/tfW7QzMOMi8RLcB6k5fAnW ctkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=5zAds6dJ80mrhRnoDvYbKky5GBmXWKQesPl/8EhCvZk=; b=AJz0AtTWe7kFxqCSK8smTQjrmx0pn9uqOOBfPilxP3kGzhJAsRVzQVMYQm1uXDj4O0 mcskBZAGU+71gg0KTXqIl3kEkl/HCoCYmkQegCm0B5rAX/H3HTM6fEyqELkOgZLstnGU 8KFFvHpTWPjSgOXm0Lc5k5EaLKOsO9RFp2cJzdXuipHbX2whX7srNP0e279yLlGfkU9o vAWYwl2z0Z3Uz9k/c93PUkmjK9elf7YxCvWpukv2TRaz3pdBcYnb9LrIJoHU3lg7FUrw 38wvjsU7ZoGgavLK1Qhh/lhh4eyxpaC0XBG/fcijYMDCgRTcBnGFtFBogHoBIatLHnp+ YvGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=h2Dut6VZ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di12-20020a170906730c00b0078e11cbb722si24820400ejc.92.2023.01.13.05.00.57; Fri, 13 Jan 2023 05:01:16 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=h2Dut6VZ; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241452AbjAMM4j (ORCPT + 65 others); Fri, 13 Jan 2023 07:56:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbjAMM4J (ORCPT ); Fri, 13 Jan 2023 07:56:09 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 146C9869E0 for ; Fri, 13 Jan 2023 04:43:29 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-482d3bf0266so224913457b3.3 for ; Fri, 13 Jan 2023 04:43:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=5zAds6dJ80mrhRnoDvYbKky5GBmXWKQesPl/8EhCvZk=; b=h2Dut6VZC2FqtL7oy/fvWGe/VTIVL+k6LwYHLR2FkVFuVGXc3s0WV8eY31lqZDwWKh +GZLiPkAzcL+WRcGMcM7/MNA/W1MzNsqmHDTlcp2g95VFjPUv/130qntwrd++Hz7+n/0 iZYxyp7+ZrspVHOMvxGO85TKD4Iznpe/vI3GpjvAvL9qLOVM9ZSXwFFWV+d8wHpoXbUO CZAzbLnoiWCQPxE0T5CqWFwGi1m1Ht81MH0GAUgOX5M5vAeX3Hh1+fxUUweQp2u1q/t9 m1hzUZx3l+xCSQ+983nb8XM5F7kA7K7nZWbEQEKhZYTBpxIzVnvsg1dvyY+VU/IHQ7dV 7B1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5zAds6dJ80mrhRnoDvYbKky5GBmXWKQesPl/8EhCvZk=; b=BHYY7+qjgxbbyiuZ7yxgcf5torxHyaHpss4jzHu64m+CuFVGTzx3LHfz1kHZ7l3v1D uNN4T3HlN1FgYCBXxEmVRP0kOY6LiMVQrnfNWMW5Ikw0B6Gr1+lL3ME13X+aQtXms6+P KyjTWx6NnNLfWcheuWZfRk5/vN/O5BkJASoTNcRJYUjMpcmeOO+zcs2Ve3jUdifoQST+ UVHC4u5hAienDaiPLRuunOexgHxZP1LRAoSVcZ1SPqdWx/FPNAF32pwbYJg/zt7r/BOE tNA8CLq35EydQ3VL2XGLdby36ZkyHViAT6dGkdaagHFQpIZB3MNuVtgLZOpPed0Db/cc yjOg== X-Gm-Message-State: AFqh2kodmdPzr5EBsICEFXW8H74XSxPRrLPUQS6xNxx92l6CZ2cQuAXE hJ0yqr84YqK8g8Y4ANN1h2nnr/P/U2MaIA== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a25:da92:0:b0:7cb:aadd:68e2 with SMTP id n140-20020a25da92000000b007cbaadd68e2mr362884ybf.266.1673613808344; Fri, 13 Jan 2023 04:43:28 -0800 (PST) Date: Fri, 13 Jan 2023 12:43:26 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230113124326.3533978-1-edumazet@google.com> Subject: [PATCH net] Revert "wifi: mac80211: fix memory leak in ieee80211_if_add()" From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni , Johannes Berg Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet , syzbot , Zhengchao Shao , Johannes Berg Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 This reverts commit 13e5afd3d773c6fc6ca2b89027befaaaa1ea7293. ieee80211_if_free() is already called from free_netdev(ndev) because ndev->priv_destructor == ieee80211_if_free syzbot reported: general protection fault, probably for non-canonical address 0xdffffc0000000004: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027] CPU: 0 PID: 10041 Comm: syz-executor.0 Not tainted 6.2.0-rc2-syzkaller-00388-g55b98837e37d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 RIP: 0010:pcpu_get_page_chunk mm/percpu.c:262 [inline] RIP: 0010:pcpu_chunk_addr_search mm/percpu.c:1619 [inline] RIP: 0010:free_percpu mm/percpu.c:2271 [inline] RIP: 0010:free_percpu+0x186/0x10f0 mm/percpu.c:2254 Code: 80 3c 02 00 0f 85 f5 0e 00 00 48 8b 3b 48 01 ef e8 cf b3 0b 00 48 ba 00 00 00 00 00 fc ff df 48 8d 78 20 48 89 f9 48 c1 e9 03 <80> 3c 11 00 0f 85 3b 0e 00 00 48 8b 58 20 48 b8 00 00 00 00 00 fc RSP: 0018:ffffc90004ba7068 EFLAGS: 00010002 RAX: 0000000000000000 RBX: ffff88823ffe2b80 RCX: 0000000000000004 RDX: dffffc0000000000 RSI: ffffffff81c1f4e7 RDI: 0000000000000020 RBP: ffffe8fffe8fc220 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 1ffffffff2179ab2 R12: ffff8880b983d000 R13: 0000000000000003 R14: 0000607f450fc220 R15: ffff88823ffe2988 FS: 00007fcb349de700(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b32220000 CR3: 000000004914f000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: netdev_run_todo+0x6bf/0x1100 net/core/dev.c:10352 ieee80211_register_hw+0x2663/0x4040 net/mac80211/main.c:1411 mac80211_hwsim_new_radio+0x2537/0x4d80 drivers/net/wireless/mac80211_hwsim.c:4583 hwsim_new_radio_nl+0xa09/0x10f0 drivers/net/wireless/mac80211_hwsim.c:5176 genl_family_rcv_msg_doit.isra.0+0x1e6/0x2d0 net/netlink/genetlink.c:968 genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline] genl_rcv_msg+0x4ff/0x7e0 net/netlink/genetlink.c:1065 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2564 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1076 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline] netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1356 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1932 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2476 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2530 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2559 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Reported-by: syzbot Fixes: 13e5afd3d773 ("wifi: mac80211: fix memory leak in ieee80211_if_add()") Signed-off-by: Eric Dumazet Cc: Zhengchao Shao Cc: Johannes Berg --- net/mac80211/iface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index e20c3fe9a0b19439794a5b6fb9f696ee6b87ce8d..23ed13f150675d1ffa869796c857f5905fb8dae8 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -2197,7 +2197,6 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ret = cfg80211_register_netdevice(ndev); if (ret) { - ieee80211_if_free(ndev); free_netdev(ndev); return ret; } -- 2.39.0.314.g84b9a713c41-goog