Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1813184pxb; Mon, 13 Sep 2021 06:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF3kzMXmMjU0UlYBqUHb8MUcvhDzoKBCgeG0Kb1ZFaxC0cGYpOaqmovmoNdyzjJ+vro3JV X-Received: by 2002:a92:130a:: with SMTP id 10mr7667944ilt.186.1631538628197; Mon, 13 Sep 2021 06:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631538628; cv=none; d=google.com; s=arc-20160816; b=BvEJ4O36TAOO/SZ2qlaPCRb2f58vy+S1VbvHfvGXvFZOh6DmpkMyKnUF8OfL7Im9qv 3DfxsXG8ebONfQGPNrYss68rTsT1mUqwCKYKddCyMNaM1nesPX66OFTcLbJ7DqsdYx1Q VJeU8Mxm26DwAzsjxP2vJNW5k+N6GPjMNuKOCng5MfsIJK4Cv1EMf1OnlQzm/eqhOy0b lvOHtAgxDB7F7u0cxtBcpooa3ireUqYPEKFwu67zBTmhqGvHGasXpTvLkVdHxu9bdku1 IcBfI3zkQMrMebEW4RUrz1eOS34jix1wHVcrASVNAA7L6CcLr0oe3QJApRPx63PfFbxl 54bA== 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=V69rkmBV3GQTLfHYSfkRm46ouFvvTB8dc9rFkPdH+N4=; b=i8SvjfII/Ij39CReIZwYkYIYxaNaLIyZpZcSm4hPa9uprWQ7ypP+/cwMF+Q70Hj4Cx 2x6EoBPSIQstlc1VXTXH8qd3gvEKy1Jd4J/lAeHCIcapu4mOuyW2qvRMlBsNavN4/vFU fT2AoDeB4YrseyafEdXCSRQKNALx6sA3qXg/e1BtLlgyW/Pjxg+47qh+Ik+BlC3i2k26 Vk5syZyClt7vI8XB3d6LeIJjXLOBghXPQYC90HzRDbbriDM5WeOLoOTwK0iU82393gOF Ak1sqIzDxSlGL6bNYfBMTcNyV8STCXE4p4CxmFcIHeBmhQ69r/Rg6h9kG3d4yVNtKHVa hG/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hzIISs98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 o29si6805900jac.75.2021.09.13.06.10.15; Mon, 13 Sep 2021 06:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=hzIISs98; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S239804AbhIMNJd (ORCPT + 99 others); Mon, 13 Sep 2021 09:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240550AbhIMNIZ (ORCPT ); Mon, 13 Sep 2021 09:08:25 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64FE4C0613E2 for ; Mon, 13 Sep 2021 06:04:25 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id c21so6427232edj.0 for ; Mon, 13 Sep 2021 06:04:25 -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=V69rkmBV3GQTLfHYSfkRm46ouFvvTB8dc9rFkPdH+N4=; b=hzIISs98X3O28GPVPgGG3S2iQKBJ1TSBHBqC277SM2ipl/ou8I+hafduL8CJBBp+zH 2tmw5+S6LnaHgspzzI8GgtNkir2isdn99yVcEsI+Fd3t5sYySPtMI2h5Te+FFFKmIJrQ 2t9PUO+KGKJsXPnCGXOxH0JmE/k+P7cfzkQHkC4MQuf/HKVE8UCg+a3KgmeOOIQNB52O dYeHbzf4UfmH/2PShMW/CfpNZEkxXwJElGs2E0XW05ImA1xOi6dmkZVJKUPpRDJMqe1p plIn3j+qGvpEo3a8sq5EuVaJ53i5ks1b43N3ecwyBzPA5Wd2VlVkLxJiYq5CUF9MvQVA ORwA== 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=V69rkmBV3GQTLfHYSfkRm46ouFvvTB8dc9rFkPdH+N4=; b=Kf6x0c5viOcC0GnWDC8Kg4dz0C4l7vvGVl3tG9CuDfNC048iYf1iHIuGE1aBjqARGm nAnnDeNUU7k+5TR44ecIH+uICdDLnmnA5V9Zwp7n7EtOtkzuc2njr6bpG3WTLiILtWcz IsP0H3hJuF6WuV9vXl7gp1ejO6YyR2aizreNZvipTlIuayor7s3YenvMq8ECo7WBteOg uFEGrnAvNDvM6+XhR8ab8PDw87NgUZjjJXZ8rDXvlgDHXrmKoBFGy0L6o3Pw4TptUGAT rmbkLyTEvNWnpEpONKb5RgnZzzJijbLZyQFJ4/VsAdaB3fQgCa5QppL+tn5XGubvrHkM E+ng== X-Gm-Message-State: AOAM53108PJjZkUArW6muSCl/S1TOGhBkHL5yfPjx1biO0GVdEu+7PTt 3f/1nQXCFRuwl+ZLD99XtIE= X-Received: by 2002:a05:6402:5215:: with SMTP id s21mr13172804edd.236.1631538264036; Mon, 13 Sep 2021 06:04:24 -0700 (PDT) Received: from agape ([5.171.73.21]) by smtp.gmail.com with ESMTPSA id by26sm1922554edb.69.2021.09.13.06.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 06:04:23 -0700 (PDT) From: Fabio Aiuto To: gregkh@linuxfoundation.org Cc: hdegoede@redhat.com, Larry.Finger@lwfinger.net, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Fabio Aiuto Subject: [PATCH] staging: rtl8723bs: protect sleepq_len access by sleep_q.lock Date: Mon, 13 Sep 2021 15:03:46 +0200 Message-Id: <20210913130346.2390-1-fabioaiuto83@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org protect sleepq_len access by sleep_q.lock and move pxmitpriv->lock after sleep_q.lock release. This fixes and completes a lockdep warning silencing done in a prevoius commit where accesses to sleep_q related fields were protected by sleep_q.lock instead of pxmitpriv->lock. Note that sleep_q.lock is already taken inside rtw_free_xmitframe_queue so we just wrap sleepq_len access. Moved pxmitpriv->lock after sleep_q.lock release to avoid locks nesting. Fixes: 78a1614a81f0 ("staging: rtl8723bs: remove possible deadlock when disconnect") Reported-by: Hans de Goede Tested-by: Fabio Aiuto Signed-off-by: Fabio Aiuto --- drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c index bf090f3b1db6..c98918e02afe 100644 --- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c +++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c @@ -294,10 +294,12 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta) /* list_del_init(&psta->wakeup_list); */ - spin_lock_bh(&pxmitpriv->lock); - rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q); + spin_lock_bh(&psta->sleep_q.lock); psta->sleepq_len = 0; + spin_unlock_bh(&psta->sleep_q.lock); + + spin_lock_bh(&pxmitpriv->lock); /* vo */ /* spin_lock_bh(&(pxmitpriv->vo_pending.lock)); */ -- 2.20.1