linux-stable/net/netrom
Nguyen Dinh Phi 9619cc7d97 netrom: Decrease sock refcount when sock timers expire
[ Upstream commit 517a16b1a8 ]

Commit 63346650c1 ("netrom: switch to sock timer API") switched to use
sock timer API. It replaces mod_timer() by sk_reset_timer(), and
del_timer() by sk_stop_timer().

Function sk_reset_timer() will increase the refcount of sock if it is
called on an inactive timer, hence, in case the timer expires, we need to
decrease the refcount ourselves in the handler, otherwise, the sock
refcount will be unbalanced and the sock will never be freed.

Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Reported-by: syzbot+10f1194569953b72f1ae@syzkaller.appspotmail.com
Fixes: 63346650c1 ("netrom: switch to sock timer API")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-28 11:13:48 +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
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
nr_timer.c netrom: Decrease sock refcount when sock timers expire 2021-07-28 11:13:48 +02:00
sysctl_net_netrom.c net: netrom: Fix error cleanup path of nr_proto_init 2019-05-02 09:58:57 +02:00