revert-kernel-rebootc-convert-simple_strtoul-to-kstrtoint.patch removed from -mm tree
The patch titled
Subject: Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint"
has been removed from the -mm tree. Its filename was
revert-kernel-rebootc-convert-simple_strtoul-to-kstrtoint.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Matteo Croce <[email protected]>
Subject: Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint"
Patch series "fix parsing of reboot= cmdline", v3.
The parsing of the reboot= cmdline has two major errors:
- a missing bound check can crash the system on reboot
- parsing of the cpu number only works if specified last
Fix both.
This patch (of 2):
This reverts commit 616feab753972b97.
kstrtoint() and simple_strtoul() have a subtle difference which makes them non interchangeable: if a non digit character is found amid the parsing, the former will return an error, while the latter will just stop parsing, e.g. simple_strtoul("123xyx") = 123.
The kernel cmdline reboot= argument allows to specify the CPU used for rebooting, with the syntax s#### among the other flags, e.g. "reboot=warm,s31,force", so if this flag is not the last given, it's silently ignored as well as the subsequent ones.
---
kernel/reboot.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
kernel/reboot.c renamed from kernel/reboot.c~revert-kernel-rebootc-convert-simple_strtoul-to-kstrtoint +7 -14
@@ -551,22 +551,15 @@ static int __init reboot_setup(char *strbreak ;case 's' : - { -int rc; - -if (isdigit (*(str+1 ))) { - rc =kstrtoint (str+1 ,0 , &reboot_cpu); -if (rc) -return rc; - }else if (str[1 ] =='m' && str[2 ] =='p' && -isdigit (*(str+3 ))) { - rc =kstrtoint (str+3 ,0 , &reboot_cpu); -if (rc) -return rc; - }else +if (isdigit (*(str+1 ))) + reboot_cpu =simple_strtoul (str+1 ,NULL ,0 ); +else if (str[1 ] =='m' && str[2 ] =='p' && +isdigit (*(str+3 ))) + reboot_cpu =simple_strtoul (str+3 ,NULL ,0 ); +else *mode =REBOOT_SOFT ;break ; - } +case 'g' : *mode =REBOOT_GPIO ;break ;
_
Patches currently in -mm which might be from [email protected] are
reboot-refactor-and-comment-the-cpu-selection-code.patch reboot-allow-to-specify-reboot-mode-via-sysfs.patch reboot-remove-cf9_safe-from-allowed-types-and-rename-cf9_force.patch