lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Dec 2022 11:35:16 +0000
From:   shaozhengchao <shaozhengchao@...wei.com>
To:     Arend van Spriel <arend.vanspriel@...adcom.com>,
        Kalle Valo <kvalo@...nel.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
        "brcm80211-dev-list.pdl@...adcom.com" 
        <brcm80211-dev-list.pdl@...adcom.com>,
        "SHA-cyfmac-dev-list@...ineon.com" <SHA-cyfmac-dev-list@...ineon.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "aspriel@...il.com" <aspriel@...il.com>,
        "franky.lin@...adcom.com" <franky.lin@...adcom.com>,
        "hante.meuleman@...adcom.com" <hante.meuleman@...adcom.com>,
        "wright.feng@...ress.com" <wright.feng@...ress.com>,
        "chi-hsien.lin@...ress.com" <chi-hsien.lin@...ress.com>,
        "a.fatoum@...gutronix.de" <a.fatoum@...gutronix.de>,
        "alsi@...g-olufsen.dk" <alsi@...g-olufsen.dk>,
        "pieterpg@...adcom.com" <pieterpg@...adcom.com>,
        "dekim@...adcom.com" <dekim@...adcom.com>,
        "linville@...driver.com" <linville@...driver.com>,
        "weiyongjun (A)" <weiyongjun1@...wei.com>,
        yuehaibing <yuehaibing@...wei.com>
Subject: RE: [PATCH] wifi: brcmfmac: unmap dma buffer in
 brcmf_msgbuf_alloc_pktid()



-----Original Message-----
From: Arend van Spriel [mailto:arend.vanspriel@...adcom.com] 
Sent: Thursday, December 22, 2022 7:00 PM
To: shaozhengchao <shaozhengchao@...wei.com>; Kalle Valo <kvalo@...nel.org>; Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: netdev@...r.kernel.org; linux-wireless@...r.kernel.org; brcm80211-dev-list.pdl@...adcom.com; SHA-cyfmac-dev-list@...ineon.com; davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org; pabeni@...hat.com; aspriel@...il.com; franky.lin@...adcom.com; hante.meuleman@...adcom.com; wright.feng@...ress.com; chi-hsien.lin@...ress.com; a.fatoum@...gutronix.de; alsi@...g-olufsen.dk; pieterpg@...adcom.com; dekim@...adcom.com; linville@...driver.com; weiyongjun (A) <weiyongjun1@...wei.com>; yuehaibing <yuehaibing@...wei.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@...utronix.de> writes:
>>
>>> On 2022-12-21 18:33:06 [+0000], Kalle Valo wrote:
>>>> Zhengchao Shao <shaozhengchao@...wei.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@...wei.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@...utronix.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. 

Zhengchao Shao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ