]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Jul 2021 16:48:59 +0000 (09:48 -0700)
commit85d17828ae4c66073509835a3aaa1bba2530cbb8
treef4f583c228c1b512633c230b1caa027517b2f6fc
parentc052b6e3b0a9c4cdea3be0fa80f6e3b564fd72e8
netrom: Decrease sock refcount when sock timers expire

Commit 76161cb883f1 ("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: 76161cb883f1 ("netrom: switch to sock timer API")
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netrom/nr_timer.c