From patchwork Tue Aug 15 16:32:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 714365 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 6D2F1C04A6A for ; Tue, 15 Aug 2023 16:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238503AbjHOQcd (ORCPT ); Tue, 15 Aug 2023 12:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238512AbjHOQcL (ORCPT ); Tue, 15 Aug 2023 12:32:11 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:242:246e::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B447810D1 for ; Tue, 15 Aug 2023 09:32:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=uBupoDaF73Sg5Uqn83H/egRMNvp5BHIxja7HEen3/54=; t=1692117130; x=1693326730; b=DVQyr8JEttETX5oK8UCBqbm3ZzoC06hwEW+4yKv9IfNqIU7Bo88h6SZU7QuZwh2VfLvz/97i7+f B24EJdjlQ2kppiAqUOkkYzYEXddS1L3HjV9IGcvVvUPSAf4amgzNif8LTYS9bXqeeEudsTLfksqI5 oG09cL5f+28Glwmak7OyvS5+H66TbgGoy4v2xyqxHqRMCTs5ZVy9enmLA5TkiIdUrmIwp3xfI7Y36 R/dT0H2StS/ZqZexgfMpNGhhcCmi9aqTJdnt9spWkszMOc0Qzaes0ma+QLHORCitDE/FwIFK6NVYg drWolsiDzahMhcMA4ap7QIhLRl7TgOOisq2w==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1qVwxj-0092pv-33; Tue, 15 Aug 2023 18:32:08 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , syzbot+09d1cd2f71e6dd3bfd2c@syzkaller.appspotmail.com Subject: [PATCH] wifi: cfg80211: ocb: don't leave if not joined Date: Tue, 15 Aug 2023 18:32:03 +0200 Message-ID: <20230815183202.f5edf5ebc737.I3cbb49aa52aed2bace903a019f7300c66c61ea83@changeid> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg 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 --- net/wireless/ocb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/wireless/ocb.c b/net/wireless/ocb.c index 27a1732264f9..29afaf3da54f 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));