Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp24885pxb; Mon, 13 Sep 2021 11:58:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+d0b3Mk7S4bLFB6+JXt+L9Y7rDpwg8IuNGr5astO1szTPgmoVprE3kcU4DkIvRBOP9uVl X-Received: by 2002:a17:907:2d0b:: with SMTP id gs11mr2304536ejc.151.1631559497343; Mon, 13 Sep 2021 11:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631559497; cv=none; d=google.com; s=arc-20160816; b=UDUeknu9S6Q3ch4CCCr2oLyD3Ehdfiad9T5hAQajai7bAcFs6Uz8BQDWYrqJZP4J2s U/efhTTSQB3rrdaWDZmCOQQFQ/YgP3A3dX3d8GXY8w9NWrQiIOtpONVtV4dZAzv0VZnp ytNwHJMXYgnwq/em4GdTX18sgv/2ZGl/NciGA+JrEBm9iYH3Jo438fUYKI2kuK4ZJEd3 sjGEiWkavTx3S6GDjSyizzQrnSwiTtMPEpAFgxGTKb/XXbR27JYF+D7xzrBcvU62x8X4 SkrvHwO4jKkXKNeQoLv3l0pOTgr1i4oRV1YuumXC5yf1XucD/yQGYNssP3ZNhtvMRhaq n2ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=GXsTS2qgj0DJKAnZpWeQ2GgDU/t21LtMn8iMahLaDWw=; b=HOIUYurXZ+2nHDKVx7XRTM5ggMAJhXTNCfZFxcLr2FXoErvuo+Q7xLwUZmfxd5kkoZ UP/2qqjNAa+fqZgHMDDohcencCxA4l2MdQUcZ5OivnTvf/it5UFRWxhmnMNexebhS+cM 1q+vkvWOZ2eD3zPKxATc3+Ff+ntpmTNa8sxDLMWi6dD6pmWKuLjJx+3lRaYdkdr6X0q9 2ZdWa2MfndgqpeAE2UZo08/+CP5Tkk+wKhyOM7C4R28ez6gXrqs79Qt0wVopeTRlm1Cy b69+wdWexqoFJsEh86NcAAIqKgRwRPQi6aqyZtAGZjs94WD/pkmP2sbhhMnC5blC5Ba1 wReQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SDwiwHFi; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si9079073ejy.710.2021.09.13.11.57.53; Mon, 13 Sep 2021 11:58:17 -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=@redhat.com header.s=mimecast20190719 header.b=SDwiwHFi; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241246AbhIMN2u (ORCPT + 99 others); Mon, 13 Sep 2021 09:28:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59326 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241855AbhIMN0D (ORCPT ); Mon, 13 Sep 2021 09:26:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631539487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GXsTS2qgj0DJKAnZpWeQ2GgDU/t21LtMn8iMahLaDWw=; b=SDwiwHFiCU/piGQxUnn/varq5ECJhVdIE9UWZnGiGpLR+4p8/7sF/QpQzu7Nghb8chiJNP zVs6iUlbsiW++jrDxHdjpdKIu9VFt38Hw/zVASJ7cLUMU/gRZCBcOCR8z9gTHH4Ny7Dus2 1sdjCTbKTndGgosQ6Zs+CWOLrFtEXbc= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-fk7ovpuDNDCTdcEVp7s7HQ-1; Mon, 13 Sep 2021 09:24:46 -0400 X-MC-Unique: fk7ovpuDNDCTdcEVp7s7HQ-1 Received: by mail-ej1-f70.google.com with SMTP id o7-20020a170906288700b005bb05cb6e25so3644738ejd.23 for ; Mon, 13 Sep 2021 06:24:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GXsTS2qgj0DJKAnZpWeQ2GgDU/t21LtMn8iMahLaDWw=; b=2tzkvjXsNt88TR1FwkP77ewycTwb4lEzAcyOINmgTF0G8DuQZ6FGk5sG8P+kXTO2Jm 96FhF/PfaHIpH2qakdODldFRHsCym7VLp3lI2IBc5lKASFbS7xTpdGSyx7i3wQUehMOU TDU7Mv+6/615BuzxMKNakyRc3EfPYNmbsI0VoXYJrgt0tlhNKIIL1mlORTuIuoMDxjUK uEki8gF9cKLC80fF8hXTIhoGytgtSqBZq/Oe4gMvkoM5m9qbkbEbUJ94nkrdJQxOj9cA 23AYeBAlxEJbvybXkvRbdRC3WOn6ZcF7xG+fb3lTQ25I6+sv8WguLOP/fcJujzO49oBg d7UQ== X-Gm-Message-State: AOAM532z4LceLQxQVqFD15x+QKXMCkjYAYIs5AGHv2Npd0JLh3SC4qzH 5DMx5taH0ROi6m0A5iFZBnb2anK9HRYnCAbAAl1MDs2wh+Hs8exZHDE0Y9pgthPl6r1/gcA23yv fOSbqmuYj9LVWxbQdnu9uHlszFfWkMCdD6aRCf+b52S1NCTdyNfsWQqrefNkEL7LoxwY2opwTp/ y2 X-Received: by 2002:aa7:c617:: with SMTP id h23mr11717115edq.357.1631539485288; Mon, 13 Sep 2021 06:24:45 -0700 (PDT) X-Received: by 2002:aa7:c617:: with SMTP id h23mr11717099edq.357.1631539485094; Mon, 13 Sep 2021 06:24:45 -0700 (PDT) Received: from x1.localdomain ([81.30.35.201]) by smtp.gmail.com with ESMTPSA id y5sm2773354edt.21.2021.09.13.06.24.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Sep 2021 06:24:44 -0700 (PDT) Subject: Re: [PATCH] staging: rtl8723bs: protect sleepq_len access by sleep_q.lock To: Fabio Aiuto , gregkh@linuxfoundation.org Cc: Larry.Finger@lwfinger.net, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org References: <20210913130346.2390-1-fabioaiuto83@gmail.com> From: Hans de Goede Message-ID: Date: Mon, 13 Sep 2021 15:24:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210913130346.2390-1-fabioaiuto83@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Fabio, On 9/13/21 3:03 PM, Fabio Aiuto wrote: > 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); AFAICT this needs to be above the rtw_free_xmitframe_queue() ? Regards, Hans > psta->sleepq_len = 0; > + spin_unlock_bh(&psta->sleep_q.lock); > + > + spin_lock_bh(&pxmitpriv->lock); > > /* vo */ > /* spin_lock_bh(&(pxmitpriv->vo_pending.lock)); */ >