]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
net: hdlc_ppp: Fix issues when mod_timer is called while timer is running
authorXie He <xie.he.0141@gmail.com>
Mon, 28 Dec 2020 02:53:39 +0000 (18:53 -0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 19 Feb 2021 15:43:48 +0000 (16:43 +0100)
commit5f1f3468765d53db275f5ba26855c57f3cef3d76
tree1703ada36ced1e335f83a6aa1fe08d0da5e68c09
parentc997329302a914a5eee61ad0efa86a7fd66331ac
net: hdlc_ppp: Fix issues when mod_timer is called while timer is running

BugLink: https://bugs.launchpad.net/bugs/1913486
[ Upstream commit 1fef73597fa545c35fddc953979013882fbd4e55 ]

ppp_cp_event is called directly or indirectly by ppp_rx with "ppp->lock"
held. It may call mod_timer to add a new timer. However, at the same time
ppp_timer may be already running and waiting for "ppp->lock". In this
case, there's no need for ppp_timer to continue running and it can just
exit.

If we let ppp_timer continue running, it may call add_timer. This causes
kernel panic because add_timer can't be called with a timer pending.
This patch fixes this problem.

Fixes: e022c2f07ae5 ("WAN: new synchronous PPP implementation for generic HDLC.")
Cc: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: Xie He <xie.he.0141@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: William Breathitt Gray <william.gray@canonical.com>
drivers/net/wan/hdlc_ppp.c