• M
    Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint" · 8b92c4ff
    Matteo Croce 提交于
    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 616feab7.
    
    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.
    
    Fixes: 616feab7 ("kernel/reboot.c: convert simple_strtoul to kstrtoint")
    Signed-off-by: NMatteo Croce <mcroce@microsoft.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Robin Holt <robinmholt@gmail.com>
    Cc: Fabian Frederick <fabf@skynet.be>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: <stable@vger.kernel.org>
    Link: https://lkml.kernel.org/r/20201103214025.116799-2-mcroce@linux.microsoft.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    8b92c4ff
reboot.c 14.0 KB