linux/drivers/net/ppp
Xin Long fd59cd035b pptp: dst_release sk_dst_cache in pptp_sock_destruct
commit 9417d81f4f upstream.

sk_setup_caps() is called to set sk->sk_dst_cache in pptp_connect,
so we have to dst_release(sk->sk_dst_cache) in pptp_sock_destruct,
otherwise, the dst refcnt will leak.

It can be reproduced by this syz log:

  r1 = socket$pptp(0x18, 0x1, 0x2)
  bind$pptp(r1, &(0x7f0000000100)={0x18, 0x2, {0x0, @local}}, 0x1e)
  connect$pptp(r1, &(0x7f0000000000)={0x18, 0x2, {0x3, @remote}}, 0x1e)

Consecutive dmesg warnings will occur:

  unregister_netdevice: waiting for lo to become free. Usage count = 1

v1->v2:
  - use rcu_dereference_protected() instead of rcu_dereference_check(),
    as suggested by Eric.

Fixes: 00959ade36 ("PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)")
Reported-by: Xiumei Mu <xmu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-07-09 22:04:18 +01:00
..
bsd_comp.c ppp: Move the PPP drivers 2011-08-27 00:58:26 -07:00
Kconfig tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
Makefile ppp: Move the PPP drivers 2011-08-27 00:58:26 -07:00
ppp_async.c tty: Fix recursive deadlock in tty_perform_flush() 2013-03-18 16:52:24 -07:00
ppp_deflate.c ppp: deflate: never return len larger than output buffer 2015-02-10 13:38:50 +00:00
ppp_generic.c ppp: remove the PPPIOCDETACH ioctl 2018-10-21 08:46:19 +01:00
ppp_mppe.c drivers/net/*: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
ppp_mppe.h ppp: Move the PPP drivers 2011-08-27 00:58:26 -07:00
ppp_synctty.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-05-01 14:08:52 -07:00
pppoe.c pppoe: fix reception of frames with no mac header 2018-12-16 22:09:19 +00:00
pppox.c ppp: Replace uses of <linux/if_ppp.h> with <linux/ppp-ioctl.h> 2012-03-04 20:41:38 -05:00
pptp.c pptp: dst_release sk_dst_cache in pptp_sock_destruct 2019-07-09 22:04:18 +01:00