mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
netrom: switch to sock timer API
[ Upstream commit 63346650c1
]
sk_reset_timer() and sk_stop_timer() properly handle
sock refcnt for timer function. Switching to them
could fix a refcounting bug reported by syzbot.
Reported-and-tested-by: syzbot+defa700d16f1bd1b9a05@syzkaller.appspotmail.com
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-hams@vger.kernel.org
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f6ed795983
commit
0adf571fa3
|
@ -53,21 +53,21 @@ void nr_start_t1timer(struct sock *sk)
|
|||
{
|
||||
struct nr_sock *nr = nr_sk(sk);
|
||||
|
||||
mod_timer(&nr->t1timer, jiffies + nr->t1);
|
||||
sk_reset_timer(sk, &nr->t1timer, jiffies + nr->t1);
|
||||
}
|
||||
|
||||
void nr_start_t2timer(struct sock *sk)
|
||||
{
|
||||
struct nr_sock *nr = nr_sk(sk);
|
||||
|
||||
mod_timer(&nr->t2timer, jiffies + nr->t2);
|
||||
sk_reset_timer(sk, &nr->t2timer, jiffies + nr->t2);
|
||||
}
|
||||
|
||||
void nr_start_t4timer(struct sock *sk)
|
||||
{
|
||||
struct nr_sock *nr = nr_sk(sk);
|
||||
|
||||
mod_timer(&nr->t4timer, jiffies + nr->t4);
|
||||
sk_reset_timer(sk, &nr->t4timer, jiffies + nr->t4);
|
||||
}
|
||||
|
||||
void nr_start_idletimer(struct sock *sk)
|
||||
|
@ -75,37 +75,37 @@ void nr_start_idletimer(struct sock *sk)
|
|||
struct nr_sock *nr = nr_sk(sk);
|
||||
|
||||
if (nr->idle > 0)
|
||||
mod_timer(&nr->idletimer, jiffies + nr->idle);
|
||||
sk_reset_timer(sk, &nr->idletimer, jiffies + nr->idle);
|
||||
}
|
||||
|
||||
void nr_start_heartbeat(struct sock *sk)
|
||||
{
|
||||
mod_timer(&sk->sk_timer, jiffies + 5 * HZ);
|
||||
sk_reset_timer(sk, &sk->sk_timer, jiffies + 5 * HZ);
|
||||
}
|
||||
|
||||
void nr_stop_t1timer(struct sock *sk)
|
||||
{
|
||||
del_timer(&nr_sk(sk)->t1timer);
|
||||
sk_stop_timer(sk, &nr_sk(sk)->t1timer);
|
||||
}
|
||||
|
||||
void nr_stop_t2timer(struct sock *sk)
|
||||
{
|
||||
del_timer(&nr_sk(sk)->t2timer);
|
||||
sk_stop_timer(sk, &nr_sk(sk)->t2timer);
|
||||
}
|
||||
|
||||
void nr_stop_t4timer(struct sock *sk)
|
||||
{
|
||||
del_timer(&nr_sk(sk)->t4timer);
|
||||
sk_stop_timer(sk, &nr_sk(sk)->t4timer);
|
||||
}
|
||||
|
||||
void nr_stop_idletimer(struct sock *sk)
|
||||
{
|
||||
del_timer(&nr_sk(sk)->idletimer);
|
||||
sk_stop_timer(sk, &nr_sk(sk)->idletimer);
|
||||
}
|
||||
|
||||
void nr_stop_heartbeat(struct sock *sk)
|
||||
{
|
||||
del_timer(&sk->sk_timer);
|
||||
sk_stop_timer(sk, &sk->sk_timer);
|
||||
}
|
||||
|
||||
int nr_t1timer_running(struct sock *sk)
|
||||
|
|
Loading…
Reference in New Issue
Block a user