[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e551618e-4a10-3973-73fe-47542758b6e1@deic.uab.cat>
Date: Fri, 12 Aug 2016 16:15:03 +0200
From: Gerard Garcia <ggarcia@...a.uab.cat>
To: Stefan Hajnoczi <stefanha@...hat.com>
Cc: netdev@...r.kernel.org, jhansen@...are.com, mst@...hat.com
Subject: Re: [PATCH 1/3] vsockmon: Add tap functions.
On 08/10/2016 01:40 PM, Stefan Hajnoczi wrote:
> On Mon, Aug 08, 2016 at 06:14:40PM +0200, ggarcia@...a.uab.cat wrote:
>> +static int __vsock_deliver_tap_skb(struct sk_buff *skb,
>> + struct net_device *dev)
>> +{
>> + int ret = 0;
>> +
>> + if (skb) {
>> + dev_hold(dev);
>> + /* Take skb ownership so it is not consumed in dev_queue_xmit.
>> + * dev_queue_xmit will drop a reference so the reference count
>> + * will reset.
>> + */
>> + skb_get(skb);
>
> Netlink clones the skb instead of adding a reference. I guess this is
> because the skb might be modified later on? Perhaps there are race
> conditions if the original skb is shared.
>
Seems that it is responsibility of the functions processing the skb to
make sure that it is not modified (without performing a copy) if it is a
shared skb, as it is the case. vsockmon doesn't modify it and from what
I understand it is not modified along the tx path but, of course, I
could be missing something.
As it is not performance critical it will be safer to just clone the skb
so I'll do that.
Powered by blists - more mailing lists