From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: shaozhengchao <shaozhengchao@huawei.com>,
Kalle Valo <kvalo@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"brcm80211-dev-list.pdl@broadcom.com"
<brcm80211-dev-list.pdl@broadcom.com>,
"SHA-cyfmac-dev-list@infineon.com"
<SHA-cyfmac-dev-list@infineon.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"aspriel@gmail.com" <aspriel@gmail.com>,
"franky.lin@broadcom.com" <franky.lin@broadcom.com>,
"hante.meuleman@broadcom.com" <hante.meuleman@broadcom.com>,
"wright.feng@cypress.com" <wright.feng@cypress.com>,
"chi-hsien.lin@cypress.com" <chi-hsien.lin@cypress.com>,
"a.fatoum@pengutronix.de" <a.fatoum@pengutronix.de>,
"alsi@bang-olufsen.dk" <alsi@bang-olufsen.dk>,
"pieterpg@broadcom.com" <pieterpg@broadcom.com>,
"dekim@broadcom.com" <dekim@broadcom.com>,
"linville@tuxdriver.com" <linville@tuxdriver.com>,
"weiyongjun (A)" <weiyongjun1@huawei.com>,
yuehaibing <yuehaibing@huawei.com>
Subject: Re: [PATCH] wifi: brcmfmac: unmap dma buffer in brcmf_msgbuf_alloc_pktid()
Date: Thu, 22 Dec 2022 12:37:04 +0100 [thread overview]
Message-ID: <58d61ba6-3cd9-cfee-d6d1-2bb800853eb4@broadcom.com> (raw)
In-Reply-To: <fc8a7c6ac335473b901aa9815167754f@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 2530 bytes --]
On 12/22/2022 12:35 PM, shaozhengchao wrote:
>
>
> -----Original Message-----
> From: Arend van Spriel [mailto:arend.vanspriel@broadcom.com]
> Sent: Thursday, December 22, 2022 7:00 PM
> To: shaozhengchao <shaozhengchao@huawei.com>; Kalle Valo <kvalo@kernel.org>; Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: netdev@vger.kernel.org; linux-wireless@vger.kernel.org; brcm80211-dev-list.pdl@broadcom.com; SHA-cyfmac-dev-list@infineon.com; davem@davemloft.net; edumazet@google.com; kuba@kernel.org; pabeni@redhat.com; aspriel@gmail.com; franky.lin@broadcom.com; hante.meuleman@broadcom.com; wright.feng@cypress.com; chi-hsien.lin@cypress.com; a.fatoum@pengutronix.de; alsi@bang-olufsen.dk; pieterpg@broadcom.com; dekim@broadcom.com; linville@tuxdriver.com; weiyongjun (A) <weiyongjun1@huawei.com>; yuehaibing <yuehaibing@huawei.com>
> Subject: Re: [PATCH] wifi: brcmfmac: unmap dma buffer in brcmf_msgbuf_alloc_pktid()
>
> On 12/22/2022 9:52 AM, shaozhengchao wrote:
>>
>>
>> On 2022/12/22 16:46, Kalle Valo wrote:
>>> Sebastian Andrzej Siewior <bigeasy@linutronix.de> writes:
>>>
>>>> On 2022-12-21 18:33:06 [+0000], Kalle Valo wrote:
>>>>> Zhengchao Shao <shaozhengchao@huawei.com> wrote:
>>>>>
>>>>>> After the DMA buffer is mapped to a physical address, address is
>>>>>> stored
>>>>>> in pktids in brcmf_msgbuf_alloc_pktid(). Then, pktids is parsed in
>>>>>> brcmf_msgbuf_get_pktid()/brcmf_msgbuf_release_array() to obtain
>>>>>> physaddr
>>>>>> and later unmap the DMA buffer. But when count is always equal to
>>>>>> pktids->array_size, physaddr isn't stored in pktids and the DMA buffer
>>>>>> will not be unmapped anyway.
>>>>>>
>>>>>> Fixes: 9a1bb60250d2 ("brcmfmac: Adding msgbuf protocol.")
>>>>>> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>>>>>
>>>>> Can someone review this?
>>>>
>>>> After looking at the code, that skb is mapped but not inserted into the
>>>> ringbuffer in this condition. The function returns with an error and the
>>>> caller will free that skb (or add to a list for later). Either way the
>>>> skb remains mapped which is wrong. The unmap here is the right thing to
>>>> do.
>>>>
>>>> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>>>
>>> Thanks for the review, very much appreciated.
>>>
>>
>> Thank you very much.
>
>> Good catch. Has this path been observed or is this found by inspecting
>> the code? Just curious.
>
>> Regards,
>> Arend
>
> Hi Arend:
> I review code and find the bug.
Much appreciated.
Regards,
Arend
> Zhengchao Shao
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]
next prev parent reply other threads:[~2022-12-22 11:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 1:31 [PATCH] wifi: brcmfmac: unmap dma buffer in brcmf_msgbuf_alloc_pktid() Zhengchao Shao
2022-12-21 18:33 ` Kalle Valo
2022-12-22 7:38 ` Sebastian Andrzej Siewior
2022-12-22 8:46 ` Kalle Valo
2022-12-22 8:52 ` shaozhengchao
2022-12-22 10:59 ` Arend van Spriel
2022-12-22 11:35 ` shaozhengchao
2022-12-22 11:37 ` Arend van Spriel [this message]
2022-12-22 16:10 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58d61ba6-3cd9-cfee-d6d1-2bb800853eb4@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=SHA-cyfmac-dev-list@infineon.com \
--cc=a.fatoum@pengutronix.de \
--cc=alsi@bang-olufsen.dk \
--cc=aspriel@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=chi-hsien.lin@cypress.com \
--cc=davem@davemloft.net \
--cc=dekim@broadcom.com \
--cc=edumazet@google.com \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pieterpg@broadcom.com \
--cc=shaozhengchao@huawei.com \
--cc=weiyongjun1@huawei.com \
--cc=wright.feng@cypress.com \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).