[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8901eba5-17a1-bd16-841c-3858475cfb71@huawei.com>
Date: Wed, 4 Dec 2019 09:33:05 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: David Miller <davem@...emloft.net>
CC: <tanhuazhong@...wei.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <salil.mehta@...wei.com>,
<yisen.zhuang@...wei.com>, <linuxarm@...wei.com>,
<jakub.kicinski@...ronome.com>
Subject: Re: [PATCH net 2/3] net: hns3: fix a use after free problem in
hns3_nic_maybe_stop_tx()
On 2019/12/4 3:57, David Miller wrote:
> From: Yunsheng Lin <linyunsheng@...wei.com>
> Date: Tue, 3 Dec 2019 12:22:11 +0800
>
>> 2. When skb_copy() returns success, the hns3_nic_maybe_stop_tx()
>> returns -EBUSY when there are not no enough space in the ring to
>> send the skb to hardware, and hns3_nic_net_xmit() will return
>> NETDEV_TX_BUSY to the upper layer, the upper layer will resend the old
>> skb later when driver wakes up the queue, but the old skb has been freed
>> by the hns3_nic_maybe_stop_tx(). Because when using the skb_copy() to
>> linearize a skb, it will return a new linearized skb, and the old skb is
>> freed, the upper layer does not have a reference to the new skb and resend
>> using the old skb, which casues a use after freed problem.
>>
>> This patch is trying to fixes the case 2.
>>
>> Maybe I should mention why hns3_nic_maybe_stop_tx() returns -EBUSY to
>> better describe the problem?
>
> I think it would help understand the code path you are fixing, yes.
Will mention that in the next version, thanks.
>
> .
>
Powered by blists - more mailing lists