Skip to contentSkip to conversation

idr: remove WARN_ON_ONCE() when trying to check id

PATCH In review Anmol Karn 3 participants 7 messages Sep 14, 2020 – Sep 15, 2020

Subsystems (5)
lore
Share & tools
lore

Anmol Karn

author
#0 lore raw

PATCH 1/1 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")

---
 lib/idr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/idr.c +1 -1
index 4d2eef0259d2..7c67560c1ecd 100644
@@ -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;
Signature · 5 lines
2.28.0
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
maintainer
#1 lore raw
Quoted 9 lines · Anmol Karn

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")

https://lore.kernel.org/netdev/[email protected]/
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#2 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 5 lines · Anmol Karn

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.

Quoted 6 lines
Quoted 4 lines

Reference: commit b9959c7a347 ("filldir[64]: remove WARN_ON_ONCE() for bad directory entries")

https://lore.kernel.org/netdev/[email protected]/

Hello sir,

I have looked into the patch, and it seems the problem is fixed to the root cause in this patch, but not yet merged due to some backport issues, so, please ignore this patch(sent by me), and please let me know if i can contribute to fixing this bug's root cause.

Thanks,
Anmol
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

maintainer
#3 lore raw
Quoted 12 lines · Anmol Karn
Quoted 11 lines · Matthew Wilcox
Quoted 9 lines · Anmol Karn

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")

Quoted 8 lines
Quoted 1 line

https://lore.kernel.org/netdev/[email protected]/

Hello sir,

I have looked into the patch, and it seems the problem is fixed to the root cause in this patch, but not yet merged due to some backport issues, so, please ignore this patch(sent by me), and please let me know if i can contribute to fixing this bug's root cause.

The root cause is that the network maintainers believe I have a far greater interest in the qrtr code than I actually do, and the maintainer of the qrtr code is not doing anything.

author
#4 lore raw
Quoted 17 lines · Matthew Wilcox
Quoted 16 lines · Anmol Karn
Quoted 6 lines · Matthew Wilcox
Quoted 5 lines · Anmol Karn

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.

Quoted 6 lines
Quoted 4 lines

Reference: commit b9959c7a347 ("filldir[64]: remove WARN_ON_ONCE() for bad directory entries")

https://lore.kernel.org/netdev/[email protected]/

Hello sir,

Quoted 8 lines
Quoted 4 lines

I have looked into the patch, and it seems the problem is fixed to the root cause in this patch, but not yet merged due to some backport issues, so, please ignore this patch(sent by me), and please let me know if i can contribute to fixing this bug's root cause.

The root cause is that the network maintainers believe I have a far greater interest in the qrtr code than I actually do, and the maintainer of the qrtr code is not doing anything.

Hello sir,

I hope the patch will get merged soon.

also, i have tried a patch for this bug

can you please guide me little how should i proceede with it, and also syzbot tested it.

Thanks,
Anmol
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#5 lore raw
Quoted 23 lines · Anmol Karn
Quoted 22 lines · Matthew Wilcox
Quoted 20 lines · Anmol Karn
Quoted 6 lines · Matthew Wilcox
Quoted 5 lines · Anmol Karn

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.

Quoted 6 lines
Quoted 4 lines

Reference: commit b9959c7a347 ("filldir[64]: remove WARN_ON_ONCE() for bad directory entries")

https://lore.kernel.org/netdev/[email protected]/

Hello sir,

I have looked into the patch, and it seems the problem is fixed to the root cause in this patch, but not yet merged due to some backport issues, so, please ignore this patch(sent by me), and please let me know if i can contribute to fixing this bug's root cause.

Quoted 7 lines
Quoted 3 lines

The root cause is that the network maintainers believe I have a far greater interest in the qrtr code than I actually do, and the maintainer of the qrtr code is not doing anything.

Hello sir,

I hope the patch will get merged soon.

No need to "hope"; you could split up Matthew's patch yourself, and test and send the resulting patches. From the above thread, it looks like the networking developers want one patch to fix the improper use of GFP_ATOMIC (which is the bug reported by syzbot), and a separate patch to convert qrtr to use the XArray.

Quoted 6 lines

also, i have tried a patch for this bug

can you please guide me little how should i proceede with it, and also syzbot tested it.

Looks like something timer-related. You'll need to investigate more, write and test a fix, and send it to the appropriate kernel mailing lists and developers (which will probably be different from the ones receiving this current thread).

- Eric
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

author
#6 lore raw

Hello sir,

Quoted 7 lines
Quoted 1 line

I hope the patch will get merged soon.

No need to "hope"; you could split up Matthew's patch yourself, and test and send the resulting patches. From the above thread, it looks like the networking developers want one patch to fix the improper use of GFP_ATOMIC (which is the bug reported by syzbot), and a separate patch to convert qrtr to use the XArray.

Sure sir I will look into it.

Quoted 12 lines
Quoted 7 lines

also, i have tried a patch for this bug

can you please guide me little how should i proceede with it, and also syzbot tested it.

Looks like something timer-related. You'll need to investigate more, write and test a fix, and send it to the appropriate kernel mailing lists and developers (which will probably be different from the ones receiving this current thread).

My bad sir, will send it to the appropriate list.

Thanks
Anmol
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees