Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp887392pxb; Wed, 27 Oct 2021 14:30:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4tuwGXm97TUnk1M0R3BblZmFkeV81YKzUhOfZOSQgpjf56HKaEjS931anG5EHEyoI0hBV X-Received: by 2002:a05:6402:2155:: with SMTP id bq21mr457147edb.181.1635370201109; Wed, 27 Oct 2021 14:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370201; cv=none; d=google.com; s=arc-20160816; b=EROVMn1dVygL9AMfeHnVH/aAjzcY604oBOHuBKioCbEMj7s1nllLOvEy6PmqKvOrMR /BJGYVpeCQ8TEVGPkO1PRLTU5xmOidCjdndcdyfDq0qK66VdhXlzrjTgR8r6jdTyNmAH hSO6SY1EiwownVXcEMfjFrfLQT+Unv9Cenos0xNfvXrkIpBeIZC1a1qsudploMujtWNR q4e+qmCWrJib/6A+j9FkAYLXOFxWT1HbDynJfxV/7odlXESi/qUVFNsCFUtkJJ0tswfk AGDgKDyVvBd81/1rBJh6d1ss+sBy3HzwOuBYIy4bHlneQ7YWVjnKQqqLE6uwFJd56EuB U0Zw== 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:dkim-signature; bh=PkqSITbCIjnK7FZ/jf9UFsH0245UP24SRvOg2xF2AJ4=; b=AF4nVGXWbsfFWAv8B+L8M87piSi/NBpQap6Re9Dg3r+kpkW+I4QYygvHu8qb7Rxtz+ PPfEp39zrPQDI3SIv8yySgYIMIWZ0RjUE1/VgFrLTIIERQ/ZxnzCXLohZaUFVc+OsLW+ MMpHFhesdTHJAaydeYeP/uCdv+3bMer1LF8PFpa/MeOWCWGa8jjtPbdmtsozxOjTUwID JVKgmS27gbi18mYRIm6Wi01AgoTDZEnw5pKDCZVqvvrXGuhCzaqG5+7aTfL4rY4cyviy YvhSkAtFrOazlfnb0KswVHq/R38J7XOaZvIDRxsI0JdkyFqoIJoNG8G10X6MXKvr/kc1 mI4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GkmIV3Dc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si1182695edq.430.2021.10.27.14.29.45; Wed, 27 Oct 2021 14:30:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GkmIV3Dc; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243332AbhJ0RlL (ORCPT + 67 others); Wed, 27 Oct 2021 13:41:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236752AbhJ0RlK (ORCPT ); Wed, 27 Oct 2021 13:41:10 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49009C061570; Wed, 27 Oct 2021 10:38:45 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id na16-20020a17090b4c1000b0019f5bb661f9so2669840pjb.0; Wed, 27 Oct 2021 10:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PkqSITbCIjnK7FZ/jf9UFsH0245UP24SRvOg2xF2AJ4=; b=GkmIV3DcqQ+aCfRl4Y6y/2a5fIZC9mpAbKRbs9z1Y7tiYi1i831uFjOhbzAAWGysAO 3UPZVx7r2tGbZBrXZhSnVyBzvN8L5vH+M7r+clmkeUrb1++7B2uSf4d/xWTqoRQJiYmB BRkNi6VDh2mDqTwvNIDfhbpe5lNHV2FwX3UpdN7vMHPuVbeU2LdqwW2qqKWVFdDq4HR4 L6DMIPQ0jXAzAzEsggn5zP3GSaXqurL/rmZD2GGlgq4wqCpDfVR+yEfQA4mpKZOgom+W 3vnDBumIMm3j6q0uONWzDJ2g0qMojsO3F++5E71NIMEJShqDX2Lhtsx/nPPHYLGUrIhX K7kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PkqSITbCIjnK7FZ/jf9UFsH0245UP24SRvOg2xF2AJ4=; b=6rO3Q/FAD88ooAdwPzQAVJmoQOsa1w1BMg5jfL3XbZUDS7hkwO8KvTLE+F4m09S5Ec A1EAti7JYryekV6GG+bxycUX3g+JCu5eFxpxdszbvw/t9Zvk4yV68g20TTulesp/8h3h fLK1fqIxLuya5CiE0+WXR/f8isohGZRoR673yLecw/zFWaARjvnqtz+d5d30tTB09TM/ 53sbph49WuATzdZuUeI5qHWYhY3b8WgNv3/Yv/JBV9HU0JUDY/RIq6VPiEDQVOJMJTNJ mmYbtxdIDwoYaQze3D3GRZ4a+j76gQtJsBF3P17JTWYxUadVoq/qCZLZj7w5LsVVYUBJ TO2w== X-Gm-Message-State: AOAM531xmh+1NwXMhnqY2HbVrmiY4Xki+HR115LE+hw7BguQASptHlFF 6TVI2n7uAKIc03jfzGEYq/1tXKfPgjtAPbGviIt6gQ== X-Received: by 2002:a17:90b:1e0b:: with SMTP id pg11mr7277222pjb.230.1635356324894; Wed, 27 Oct 2021 10:38:44 -0700 (PDT) Received: from localhost.localdomain (bb42-60-144-185.singnet.com.sg. [42.60.144.185]) by smtp.gmail.com with ESMTPSA id b6sm572719pfv.171.2021.10.27.10.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 10:38:44 -0700 (PDT) From: Nguyen Dinh Phi To: johannes@sipsolutions.net, davem@davemloft.net, kuba@kernel.org Cc: Nguyen Dinh Phi , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, syzbot+bbf402b783eeb6d908db@syzkaller.appspotmail.com Subject: [PATCH v2] net:wireless: call cfg80211_stop_ap when switch from P2P_GO type Date: Thu, 28 Oct 2021 01:37:22 +0800 Message-Id: <20211027173722.777287-1-phind.uet@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org If the userspace tools switch from NL80211_IFTYPE_P2P_GO to NL80211_IFTYPE_ADHOC via send_msg(NL80211_CMD_SET_INTERFACE), it does not call the cleanup cfg80211_stop_ap(), this leads to the initialization of in-use data. For example, this path re-init the sdata->assigned_chanctx_list while it is still an element of assigned_vifs list, and makes that linked list corrupt. Signed-off-by: Nguyen Dinh Phi Reported-by: syzbot+bbf402b783eeb6d908db@syzkaller.appspotmail.com --- V2: - Fix wrong email address. net/wireless/util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/wireless/util.c b/net/wireless/util.c index 18dba3d7c638..4fdf0877092d 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -1044,6 +1044,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, switch (otype) { case NL80211_IFTYPE_AP: + case NL80211_IFTYPE_P2P_GO: cfg80211_stop_ap(rdev, dev, true); break; case NL80211_IFTYPE_ADHOC: -- 2.25.1