kernel-fxtec-pro1x/net/netrom
Xiyu Yang 275828d499 net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node
[ Upstream commit d03f228470a8c0a22b774d1f8d47071e0de4f6dd ]

nr_add_node() invokes nr_neigh_get_dev(), which returns a local
reference of the nr_neigh object to "nr_neigh" with increased refcnt.

When nr_add_node() returns, "nr_neigh" becomes invalid, so the refcount
should be decreased to keep refcount balanced.

The issue happens in one normal path of nr_add_node(), which forgets to
decrease the refcnt increased by nr_neigh_get_dev() and causes a refcnt
leak. It should decrease the refcnt before the function returns like
other normal paths do.

Fix this issue by calling nr_neigh_put() before the nr_add_node()
returns.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-29 16:31:21 +02:00
..
af_netrom.c netrom: hold sock when setting skb->destructor 2019-07-28 08:29:27 +02:00
Makefile
nr_dev.c net: Kill dev_rebuild_header 2015-03-02 16:43:41 -05:00
nr_in.c net: netrom: nr_in: mark expected switch fall-through 2017-10-22 02:00:33 +01:00
nr_loopback.c net: netrom: Fix error cleanup path of nr_proto_init 2019-05-02 09:58:57 +02:00
nr_out.c netrom: use linux/uaccess.h 2014-10-17 23:52:54 -04:00
nr_route.c net: netrom: Fix potential nr_neigh refcnt leak in nr_add_node 2020-04-29 16:31:21 +02:00
nr_subr.c netrom: use linux/uaccess.h 2014-10-17 23:52:54 -04:00
nr_timer.c netrom: switch to sock timer API 2019-02-06 17:30:07 +01:00
sysctl_net_netrom.c net: netrom: Fix error cleanup path of nr_proto_init 2019-05-02 09:58:57 +02:00