From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2566208BB for ; Wed, 20 Sep 2023 11:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7332DC433C8; Wed, 20 Sep 2023 11:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695210906; bh=3D7z9iBbiOLr/hfL5mzD5tFVrwRfIqGJhHNZim80gfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqTZ0KFrdbZgZJeFsYofmwIEWQJd+ki/Rwjal89SjAdkwSO4Kh6dvhNn0k/I1HuoP jOh5S7Uu/Z+MTx96frvkDZPQ+zp7InfPnWfv3AarKyOCYJcPP9VF2AGV1L3GieJpDj EBNkf+OK3uARZ2TSFCWb8wcm/mtbgLexYY3ZmCOI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+09d1cd2f71e6dd3bfd2c@syzkaller.appspotmail.com, Johannes Berg , Sasha Levin Subject: [PATCH 6.1 035/139] wifi: cfg80211: ocb: dont leave if not joined Date: Wed, 20 Sep 2023 13:29:29 +0200 Message-ID: <20230920112836.928182102@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230920112835.549467415@linuxfoundation.org> References: <20230920112835.549467415@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg [ Upstream commit abc76cf552e13cfa88a204b362a86b0e08e95228 ] If there's no OCB state, don't ask the driver/mac80211 to leave, since that's just confusing. Since set/clear the chandef state, that's a simple check. Reported-by: syzbot+09d1cd2f71e6dd3bfd2c@syzkaller.appspotmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/ocb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/wireless/ocb.c b/net/wireless/ocb.c index 27a1732264f95..29afaf3da54f3 100644 --- a/net/wireless/ocb.c +++ b/net/wireless/ocb.c @@ -68,6 +68,9 @@ int __cfg80211_leave_ocb(struct cfg80211_registered_device *rdev, if (!rdev->ops->leave_ocb) return -EOPNOTSUPP; + if (!wdev->u.ocb.chandef.chan) + return -ENOTCONN; + err = rdev_leave_ocb(rdev, dev); if (!err) memset(&wdev->u.ocb.chandef, 0, sizeof(wdev->u.ocb.chandef)); -- 2.40.1