[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTineDkP1EGsTn3GU+9cPO+JnaNc3ekoHyKQa=img@mail.gmail.com>
Date: Mon, 6 Sep 2010 01:51:08 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Linux Netdev List <netdev@...r.kernel.org>
Subject: Re: net: af_packet: skb_orphan should be avoided in TX path.
On Mon, Sep 6, 2010 at 1:43 AM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> Le lundi 06 septembre 2010 à 01:18 +0800, Changli Gao a écrit :
>> af_packet uses tpacket_destruct_skb() to notify its user a frame is
>> sent out through NIC, and the memory for that frame is available for
>> the others. If the driver calls skb_orphan() before the frame is sent
>> out successfully, and the user may fill other data into the space for
>> this frame, this frame will be corrupted. It became more likely after
>> skb_try_orphan() was added into dev_hard_start_xmit().
>>
>> Am I correct?
>>
>
> Yes good catch. We might add a :
>
> SKBTX_NO_EARLY_ORPHAN = 1 << 4,
>
> so that skb_orphan_try() do not early orphan this kind of skb
>
It may solve the issue of skb_orphan_try(), but some NICs still call
skb_orphan(). Maybe replacing skb_orphan() with skb_orphan_try() can
work around this issue.
localhost linux # grep skb_orphan drivers/net/ -r
drivers/net/can/dev.c: skb_orphan(skb);
drivers/net/mlx4/en_tx.c: skb_orphan(skb);
drivers/net/cxgb3/sge.c: skb_orphan(skb);
drivers/net/cxgb4/sge.c: skb_orphan(skb);
drivers/net/niu.c: skb_orphan(skb);
drivers/net/cxgb4vf/sge.c: skb_orphan(skb);
drivers/net/tun.c: skb_orphan(skb);
drivers/net/virtio_net.c: skb_orphan(skb);
drivers/net/loopback.c: skb_orphan(skb);
drivers/net/wireless/mac80211_hwsim.c: skb_orphan(skb);
drivers/net/wireless/libertas/tx.c: skb_orphan(skb);
--
Regards,
Changli Gao(xiaosuo@...il.com)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists