lkml.org 
[lkml]   [2019]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH net 2/3] net: hns3: fix a use after free problem in hns3_nic_maybe_stop_tx()
From
Date
On 2019/12/4 3:57, David Miller wrote:
> From: Yunsheng Lin <linyunsheng@huawei.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.

>
> .
>

\
 
 \ /
  Last update: 2019-12-04 02:33    [W:0.635 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site