Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2652608pxa; Mon, 17 Aug 2020 15:34:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTvHck/WmFe6NeqlSW+JdUV+UgGcfiR7hRclZZv6WMvWB/6d1Q8Ldv5vPPoep8sV/ba7OO X-Received: by 2002:aa7:ce90:: with SMTP id y16mr17462581edv.325.1597703689420; Mon, 17 Aug 2020 15:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703689; cv=none; d=google.com; s=arc-20160816; b=IShkwAjPA/4pQDIqc6iAxd432Pxjdrym7Po5wNxAsOmfNfzQUUAqEe7L2dp23cWGOq LN5ntjU+8UTauGzYwA3IvrWmt/PzlKsa6Eol7JSPEglA1mSPZ1vq81ZXkUDbJ4WUhRz6 afnCxVvnAmNuExdYURhywjUEvADVERw0mByyaW6HXYSGBUd4WGJ+/pwsqVB8RCmGKowM khRUn4IY9feSkFJA82/EilmwZwEqeKFDH8jmR7B/rjWQAfDymf/Dsa3JoYYLao+loDjW L4+pIeHQ8Du1i9gGjZ3yAuU4DzOd6uB7k6LJ8x6L1PDO+bHDBwIhC8COGSXJXXX4g6gC VPcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/yAxp8XqEp8ybShqVzb0jqFpaKcUEplT2GepS4NlUbw=; b=0jyQltbipM3ZoxK87oTcs6bnvRrHMbCGhd288cXc50pYSEIexMrHUXowG5GFQwONQw JCNIYsPn/7yVPxLIXR9pU19NG9vgwYbjwk6PomWZOrbwtROq29M6T2ZRchz50Okc8GXE htgOYDC3mIoF8i5cqGSUfuHd44zqe0LbPSpdlHEqb357h0OpFt1+KECTA9Qhb9kmDGeq SZouQ0d8hJhb7B7xA9fTe/Xf3xkzgC134erqzi3Fqz0fysbkKFKVpof0QlWHPB0SMzbD BQ2Eucv96AcvpIajzXPYFF+bQ9BGjQLqt6ExuminoWxxTnR23FJPp2A4vWT6MeY34X0o rK/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y7EsZqqs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc2si11583708edb.424.2020.08.17.15.34.26; Mon, 17 Aug 2020 15:34:49 -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=@kernel.org header.s=default header.b=Y7EsZqqs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730902AbgHQRO3 (ORCPT + 99 others); Mon, 17 Aug 2020 13:14:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:44960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388702AbgHQQMh (ORCPT ); Mon, 17 Aug 2020 12:12:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 344B922CF6; Mon, 17 Aug 2020 16:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597680756; bh=eKLmI6yIRznVo57G102CPPtPPxx8TC3m3pHQ/L+bVTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y7EsZqqszVaNPu4jg1P8CNbG1uHlDFT/xPFFxxypQHCYP4XV5kCy5+T4/CFwWmLl2 wjntZCsyR8Np9y4XFj8MrU3ZIn3HtxqPgeWtaYcLS0nKMlU16dJ9tH+E34L9Y56Vwp M/rglPecIDcZDOQ3G8YpLbV31AU5Np9VVSQ8zeQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arend van Spriel , Wright Feng , Chi-hsien Lin , Kalle Valo , Sasha Levin Subject: [PATCH 4.19 045/168] brcmfmac: set state of hanger slot to FREE when flushing PSQ Date: Mon, 17 Aug 2020 17:16:16 +0200 Message-Id: <20200817143736.011532438@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wright Feng [ Upstream commit fcdd7a875def793c38d7369633af3eba6c7cf089 ] When USB or SDIO device got abnormal bus disconnection, host driver tried to clean up the skbs in PSQ and TXQ (The skb's pointer in hanger slot linked to PSQ and TSQ), so we should set the state of skb hanger slot to BRCMF_FWS_HANGER_ITEM_STATE_FREE before freeing skb. In brcmf_fws_bus_txq_cleanup it already sets BRCMF_FWS_HANGER_ITEM_STATE_FREE before freeing skb, therefore we add the same thing in brcmf_fws_psq_flush to avoid following warning message. [ 1580.012880] ------------ [ cut here ]------------ [ 1580.017550] WARNING: CPU: 3 PID: 3065 at drivers/net/wireless/broadcom/brcm80211/brcmutil/utils.c:49 brcmu_pkt_buf_free_skb+0x21/0x30 [brcmutil] [ 1580.184017] Call Trace: [ 1580.186514] brcmf_fws_cleanup+0x14e/0x190 [brcmfmac] [ 1580.191594] brcmf_fws_del_interface+0x70/0x90 [brcmfmac] [ 1580.197029] brcmf_proto_bcdc_del_if+0xe/0x10 [brcmfmac] [ 1580.202418] brcmf_remove_interface+0x69/0x190 [brcmfmac] [ 1580.207888] brcmf_detach+0x90/0xe0 [brcmfmac] [ 1580.212385] brcmf_usb_disconnect+0x76/0xb0 [brcmfmac] [ 1580.217557] usb_unbind_interface+0x72/0x260 [ 1580.221857] device_release_driver_internal+0x141/0x200 [ 1580.227152] device_release_driver+0x12/0x20 [ 1580.231460] bus_remove_device+0xfd/0x170 [ 1580.235504] device_del+0x1d9/0x300 [ 1580.239041] usb_disable_device+0x9e/0x270 [ 1580.243160] usb_disconnect+0x94/0x270 [ 1580.246980] hub_event+0x76d/0x13b0 [ 1580.250499] process_one_work+0x144/0x360 [ 1580.254564] worker_thread+0x4d/0x3c0 [ 1580.258247] kthread+0x109/0x140 [ 1580.261515] ? rescuer_thread+0x340/0x340 [ 1580.265543] ? kthread_park+0x60/0x60 [ 1580.269237] ? SyS_exit_group+0x14/0x20 [ 1580.273118] ret_from_fork+0x25/0x30 [ 1580.300446] ------------ [ cut here ]------------ Acked-by: Arend van Spriel Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200624091608.25154-2-wright.feng@cypress.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index 1de8497d92b8a..dc7c970257d2f 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -653,6 +653,7 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, int ifidx) { + struct brcmf_fws_hanger_item *hi; bool (*matchfn)(struct sk_buff *, void *) = NULL; struct sk_buff *skb; int prec; @@ -664,6 +665,9 @@ static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); while (skb) { hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); + hi = &fws->hanger.items[hslot]; + WARN_ON(skb != hi->pkt); + hi->state = BRCMF_FWS_HANGER_ITEM_STATE_FREE; brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, true); brcmu_pkt_buf_free_skb(skb); -- 2.25.1