]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
netrom: Decrease sock refcount when sock timers expire
authorNguyen Dinh Phi <phind.uet@gmail.com>
Sun, 18 Jul 2021 14:40:13 +0000 (22:40 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 20 Sep 2021 16:49:31 +0000 (18:49 +0200)
commit2546b7de74275eff54d16cc5b56373ffd87ffd48
tree1618a7a0c90977acde6885b95232a506b963233a
parent6abd7876a8579d46e04dffa69ec4c18f1687e82b
netrom: Decrease sock refcount when sock timers expire

BugLink: https://bugs.launchpad.net/bugs/1939899
[ Upstream commit 517a16b1a88bdb6b530f48d5d153478b2552d9a8 ]

Commit 63346650c1a9 ("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: 63346650c1a9 ("netrom: switch to sock timer API")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
net/netrom/nr_timer.c