From nobody Mon Jan 10 22:30:23 2022 X-Original-To: dev-commits-src-all@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 36768193D2D2; Mon, 10 Jan 2022 22:30:24 +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 4JXpRz6Fthz4kr9; Mon, 10 Jan 2022 22:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B86F25353; Mon, 10 Jan 2022 22:30:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20AMUNFJ020272; Mon, 10 Jan 2022 22:30:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AMUNW6020271; Mon, 10 Jan 2022 22:30:23 GMT (envelope-from git) Date: Mon, 10 Jan 2022 22:30:23 GMT Message-Id: <202201102230.20AMUNW6020271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: bec766282f24 - main - LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: bec766282f242aab3a4bfba402ea74cb0ccf96fb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641853823; 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=wnjvhBFbWUuQNojp9KEOp1CizdKtS1t6IE8MptuRsR0=; b=XFz1aETKaSepRvkZq9oIVrQYkbJpyOmnPKBgs/WkJfqhP2N8rGsz0bb3w572hhhpU4+fKw XhARzBXNtmxQP++FyVblpCzRVkqGuY9JQMHCZ3k53HX+57R+bCO9LcAeezv152AeLFKDOj O6q/PasXNrqykDE+qX4oFh3kAnJnXirORRNXIRGuQzi/LODnsNTzYtcOYN91sBFvymn1V9 hDL8Sq2ei5cHqLf7UyTNIbdqY72Oa3fnn7+blM4xh5qxgJgPukYM7Soq4BKwdtcZ2rcxbk utd5hIdOwHJ7FtsmdfJdh8v3mc4NnldqrEi2s0Nxk2J9MZiwlCuRMkA7gCdGvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641853823; a=rsa-sha256; cv=none; b=NYildcrCmu3ZChoWOgmIGYjLxvVnKIz85vFWwySjboJWFdmDJIrQF7J78KywyklwmO4gqO npumQmNqOM+k7+IEeYbTbg8p1UMANvi+WiAfaYkZUuX3IBPtQ7+EUN1/fxL6RAcQ7ccONP PdhReLvbhWhKBQjoC/j5slRlKfvuaCcBXycIJuR1q+z1bd/LfKSKwzo1Cg1s3fQHvEzUNO C3+cL8QNZ0fs6YGhFr9rqSPBPgMrddn1WT0lfGJsru/iGBXDlIFAXNl2HHMLXL5diDRwqe Mqq3CDyjaHor5Iv7iXXiLEkGQjnoEZAm3Jv7o7Wtaf4dXrFPLKstuEHLgTKFNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=bec766282f242aab3a4bfba402ea74cb0ccf96fb commit bec766282f242aab3a4bfba402ea74cb0ccf96fb Author: Bjoern A. Zeeb AuthorDate: 2022-01-10 22:12:53 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-01-10 22:29:23 +0000 LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan() In lkpi_stop_hw_scan() we have to unlock around cancelling the hardware scan and an msleep to wait for the confirmation that the scan ended. Otherwise we are sleeping with the non-sleepable net80211 com lock held. At the same time we need to hold the lhw lock for the msleep(). This lock change got lost in the refactoring of lkpi_iv_newstate(). Reported by: ambrisko, delphij PR: 261075 MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/compat/linuxkpi/common/src/linux_80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 973f49e8676b..d2e095040696 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -573,11 +573,15 @@ lkpi_stop_hw_scan(struct lkpi_hw *lhw, struct ieee80211_vif *vif) hw = LHW_TO_HW(lhw); + IEEE80211_UNLOCK(lhw->ic); + LKPI_80211_LHW_LOCK(lhw); /* Need to cancel the scan. */ lkpi_80211_mo_cancel_hw_scan(hw, vif); /* Need to make sure we see ieee80211_scan_completed. */ error = msleep(lhw, &lhw->mtx, 0, "lhwscanstop", hz/2); + LKPI_80211_LHW_UNLOCK(lhw); + IEEE80211_LOCK(lhw->ic); if ((lhw->scan_flags & LKPI_SCAN_RUNNING) != 0) ic_printf(lhw->ic, "%s: failed to cancel scan: %d (%p, %p)\n",