From nobody Mon Feb 19 16:10:21 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdnZ53f21z5C54f; Mon, 19 Feb 2024 16:10:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdnZ5298Pz4NpR; Mon, 19 Feb 2024 16:10:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708359021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gKLLpeD8uX6vgMbgSDNbxHLIDAEOifP18X6tKZIPvvM=; b=I9+uT37kxulQ28fuEI/11iNjc15WTbtBVLk+6qqS7neGNeFZGFgsC6SITOMryf2xXUbWuo zMj4ivwl6DOh7rCz/QDH0fodP6+nPSdu/PJ3rur2GhnvI2dPoxh5N3UG+LPhiB1XTp17h5 CQV+z7as2ROi9IwGeEZ+sgY+V/7xWC7aQqPa3gVK4HA5d2h9AaAnZkM0cuDvz4JRCq7ydQ 4WESKgf5aGBm3Y7Nxbc+Q/4FQr+GWtiqXoFQnUwTssOH8O4PnWXlZANeU9nFqeUJwEx/4c wn/f9b1efqO6G7YcDBHCjSGhzwmNNn6cgUPC2qcgDXG85HRUjak0SAp5g7tC7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708359021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gKLLpeD8uX6vgMbgSDNbxHLIDAEOifP18X6tKZIPvvM=; b=sg4kwVRVk2tZ1rAP4633K7DwAE+naO95cxHDvpinfPqH2asIvr3DHcv8A6gYXkDPt4519E Qi2sVY5iFNILvE75bJ+NnXrcH2AvMHVdKBlTQzag4lcMCHwRwmfeQNyUCRsqwagK5ODag2 HaYASqj0rKDUsSvNpFvjf5nnFfL0Hodmc6sWG8ItB9fmjPllVJFZyS48cLis0MPB3SlUEw lGDOlqgdt+LgaMVk0FETHWJyJ0qW/APcuY2Kmf1pBU2xBvnYVatLD6Za1wi5INLjKtSTYX WxkIg0ZLthOld1RyefdjIwuy3xqdrEraByTBvHGy3g6U4/W58N+m0PfuV2AyLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708359021; a=rsa-sha256; cv=none; b=uVACcnltDOTO6uLdkYo2GBYuSGDGLMtjQXkJWp4f3l8a80SHG6LNGa47JPW+CWQUtWsXZa +Qurbn5p3Oq1chORJbiKWWu/tT2yZk/bKqb+WaUTSwwd1NNO2yH7yjcmlV7Oj7wgMrxVOs Y4kQ7guTspw3eay0jL66Ouc8ErfmhstP2GB7Gw0NlVYAVJNico2ixXL7ucaFMqm+c3TcFu 41EnizYYTgtG6dJRquGuTniI3yU0Tpw+hjZhjWRO3dijMpGwEyIvnkSX32ONma6Ed4a0jv gdO2xntUX7ODrTnt7oMq0AYaGWfNZndBXHENefKZ3ikBnjU2dRvUZj3dc6vMYA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TdnZ51GPNzh9w; Mon, 19 Feb 2024 16:10:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41JGALxk035842; Mon, 19 Feb 2024 16:10:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGALVN035839; Mon, 19 Feb 2024 16:10:21 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:10:21 GMT Message-Id: <202402191610.41JGALVN035839@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: f7c8d5448446 - releng/13.3 - net80211: fix a NULL deref in ieee80211_sta_join1() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.3 X-Git-Reftype: branch X-Git-Commit: f7c8d5448446a470baaca560f91c884e5ceeecc7 Auto-Submitted: auto-generated The branch releng/13.3 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f7c8d5448446a470baaca560f91c884e5ceeecc7 commit f7c8d5448446a470baaca560f91c884e5ceeecc7 Author: Bjoern A. Zeeb AuthorDate: 2024-01-16 18:53:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-02-19 16:07:06 +0000 net80211: fix a NULL deref in ieee80211_sta_join1() When ieee80211_sta_join1() gets an obss without ni_nt trying to lock that will cause a NULL pointer deref. Check for the table to be valid and deal with the obss node accordingly. This can happen if sta_newstate() calls ieee80211_reset_bss() for nstate == INIT and ostate != INIT. ieee80211_reset_bss() itself calls ieee80211_node_table_reset() which calls node_reclaim() which ends up in ieee80211_del_node_nt() which does remove the node from the table and sets ni_table to NULL. That node (former iv_bss) can then be returned as obss in the (*iv_update_bss)() call in join1(). Approved by: re (cperciva) Reviewed by: adrian, cc Differential Revision: https://reviews.freebsd.org/D43469 (cherry picked from commit 8a5a3e3d0436a2de9dc5c2c10bd9a471b6338233) (cherry picked from commit 755a04671dd47390f6d49695a6ac9c2d31c9935c) --- sys/net80211/ieee80211_node.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index a70edfa3acc4..0f0ecf37fe94 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -867,11 +867,14 @@ ieee80211_sta_join1(struct ieee80211_node *selbs) struct ieee80211_node_table *nt = obss->ni_table; copy_bss(selbs, obss); - ieee80211_node_decref(obss); /* iv_bss reference */ - - IEEE80211_NODE_LOCK(nt); - node_reclaim(nt, obss); /* station table reference */ - IEEE80211_NODE_UNLOCK(nt); + if (nt != NULL) { + ieee80211_node_decref(obss); /* iv_bss reference */ + IEEE80211_NODE_LOCK(nt); + node_reclaim(nt, obss); /* station table reference */ + IEEE80211_NODE_UNLOCK(nt); + } else { + ieee80211_free_node(obss); /* iv_bss reference */ + } obss = NULL; /* NB: guard against later use */ }