Messages in this thread | | | Subject | Re: [PATCH net 2/3] net: hns3: fix a use after free problem in hns3_nic_maybe_stop_tx() | From | Yunsheng Lin <> | Date | Wed, 4 Dec 2019 09:33:05 +0800 |
| |
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.
> > . >
| |