lantiq: ltq-ptm: vr9: fix skb handling in ptm_hard_start_xmit()

Call skb_orphan(skb) to call the owner's destructor function and make
the skb unowned.

This is necessary to prevent sk_wmem_alloc of a socket from overflowing,
which leads to ENOBUFS errors on application level.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
(cherry picked from commit 996f02e5ba)
v19.07.3_mercusys_ac12_duma
Martin Schiller 4 years ago committed by Hauke Mehrtens
parent 6ee0138a6c
commit 3212290a3b

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ltq-ptm PKG_NAME:=ltq-ptm
PKG_RELEASE:=1 PKG_RELEASE:=2
PKG_MAINTAINER:=John Crispin <john@phrozen.org> PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=GPL-2.0+ PKG_LICENSE:=GPL-2.0+

@ -336,6 +336,9 @@ static int ptm_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
dma_cache_wback((unsigned long)skb->data, skb->len); dma_cache_wback((unsigned long)skb->data, skb->len);
} }
/* make the skb unowned */
skb_orphan(skb);
*(struct sk_buff **)((unsigned int)skb->data - byteoff - sizeof(struct sk_buff *)) = skb; *(struct sk_buff **)((unsigned int)skb->data - byteoff - sizeof(struct sk_buff *)) = skb;
/* write back to physical memory */ /* write back to physical memory */
dma_cache_wback((unsigned long)skb->data - byteoff - sizeof(struct sk_buff *), skb->len + byteoff + sizeof(struct sk_buff *)); dma_cache_wback((unsigned long)skb->data - byteoff - sizeof(struct sk_buff *), skb->len + byteoff + sizeof(struct sk_buff *));

Loading…
Cancel
Save