[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200914071724.202365-1-anmol.karan123@gmail.com>
Date: Mon, 14 Sep 2020 12:47:24 +0530
From: Anmol Karn <anmol.karan123@...il.com>
To: willy@...radead.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
anmol.karan123@...il.com,
syzbot+f7204dcf3df4bb4ce42c@...kaller.appspotmail.com
Subject: [Linux-kernel-mentees] [PATCH] idr: remove WARN_ON_ONCE() when trying to check id
idr_get_next() gives WARN_ON_ONCE() when it gets (id > INT_MAX) true
and this happens when syzbot does fuzzing, and that warning is
expected, but WARN_ON_ONCE() is not required here and, cecking
the condition and returning NULL value would be suffice.
Reference: commit b9959c7a347 ("filldir[64]: remove WARN_ON_ONCE() for bad directory entries")
Reported-and-tested-by: syzbot+f7204dcf3df4bb4ce42c@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=f7204dcf3df4bb4ce42c
Signed-off-by: Anmol Karn <anmol.karan123@...il.com>
---
lib/idr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/idr.c b/lib/idr.c
index 4d2eef0259d2..7c67560c1ecd 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -266,7 +266,7 @@ void *idr_get_next(struct idr *idr, int *nextid)
unsigned long id = *nextid;
void *entry = idr_get_next_ul(idr, &id);
- if (WARN_ON_ONCE(id > INT_MAX))
+ if (id > INT_MAX)
return NULL;
*nextid = id;
return entry;
--
2.28.0
Powered by blists - more mailing lists