netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppp: Fix deadlock caused by unsafe-irq lock in ap_get()
@ 2024-04-18 17:59 Jeongjun Park
  0 siblings, 0 replies; only message in thread
From: Jeongjun Park @ 2024-04-18 17:59 UTC (permalink / raw)
  To: davem
  Cc: edumazet, kuba, pabeni, linux-kernel, linux-ppp, netdev,
	syzkaller-bugs, syzbot+393d0ef63475d9bb1f16, Jeongjun Park


read_lock() present in ap_get() is interrupt-vulnerable, so the function needs to be modified.


Reported-by: syzbot+393d0ef63475d9bb1f16@syzkaller.appspotmail.com
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jeongjun Park <aha310510@gmail.com>
---
 drivers/net/ppp/ppp_async.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ppp/ppp_async.c b/drivers/net/ppp/ppp_async.c
index c33c3db3cc08..dc1d4633428a 100644
--- a/drivers/net/ppp/ppp_async.c
+++ b/drivers/net/ppp/ppp_async.c
@@ -133,12 +133,13 @@ static DEFINE_RWLOCK(disc_data_lock);
 static struct asyncppp *ap_get(struct tty_struct *tty)
 {
 	struct asyncppp *ap;
+	unsigned long flags;
 
-	read_lock(&disc_data_lock);
+	flags = read_lock_irqsave(&disc_data_lock);
 	ap = tty->disc_data;
 	if (ap != NULL)
 		refcount_inc(&ap->refcnt);
-	read_unlock(&disc_data_lock);
+	read_unlock_irqrestore(&disc_data_lock, flags);
 	return ap;
 }
 
-- 
2.34.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-18 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-18 17:59 [PATCH] ppp: Fix deadlock caused by unsafe-irq lock in ap_get() Jeongjun Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).