diff options
author | Xin Long <lucien.xin@gmail.com> | 2020-07-07 02:02:32 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-08 15:24:33 -0700 |
commit | 27d53323664c549b5bb2dfaaf6f7ad6e0376a64e (patch) | |
tree | c5d8199ae8714311b5e28cd8d1415959607ea464 /net/xfrm/xfrm_inout.h | |
parent | 1412bb2b4bb7e05b694742748b0f315664d91450 (diff) |
l2tp: remove skb_dst_set() from l2tp_xmit_skb()
In the tx path of l2tp, l2tp_xmit_skb() calls skb_dst_set() to set
skb's dst. However, it will eventually call inet6_csk_xmit() or
ip_queue_xmit() where skb's dst will be overwritten by:
skb_dst_set_noref(skb, dst);
without releasing the old dst in skb. Then it causes dst/dev refcnt leak:
unregister_netdevice: waiting for eth0 to become free. Usage count = 1
This can be reproduced by simply running:
# modprobe l2tp_eth && modprobe l2tp_ip
# sh ./tools/testing/selftests/net/l2tp.sh
So before going to inet6_csk_xmit() or ip_queue_xmit(), skb's dst
should be dropped. This patch is to fix it by removing skb_dst_set()
from l2tp_xmit_skb() and moving skb_dst_drop() into l2tp_xmit_core().
Fixes: 3557baabf280 ("[L2TP]: PPP over L2TP driver core")
Reported-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: James Chapman <jchapman@katalix.com>
Tested-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_inout.h')
0 files changed, 0 insertions, 0 deletions