On 08/10/2016 01:40 PM, Stefan Hajnoczi wrote:
On Mon, Aug 08, 2016 at 06:14:40PM +0200, ggar...@abra.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.