From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9748C5517A for ; Tue, 27 Oct 2020 13:42:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 835C6218AC for ; Tue, 27 Oct 2020 13:42:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603806127; bh=rPZ1e/apu/84Ff1QPQDnMRCJ/51pT/Q3Isr+hNwHq6Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=WpmtzHELYgP0aQTUyl0bxQ1OMRA9gqufJm/oJXOMXfxxN3FTSr0QAZzjy6ouR3pce 7FwZLPqURLmUWbmBE+40qtFm0LmgUJywvib2Oh3/6dAXWInqic5MjRP64fSNhnPrQt lhAKzpWW5PxoHsIitXBdfoqZ9IwXVNIxklDSbckc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752428AbgJ0NmG (ORCPT ); Tue, 27 Oct 2020 09:42:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:39102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409344AbgJ0NmD (ORCPT ); Tue, 27 Oct 2020 09:42:03 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1B64221707; Tue, 27 Oct 2020 13:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603806123; bh=rPZ1e/apu/84Ff1QPQDnMRCJ/51pT/Q3Isr+hNwHq6Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c12dLILyQZuTBNo8D1k8FZjOVq+3z/v8Qu23932n5kBMI4MsxM7WSJbX+91AHRjvC RA1KiR0UNpH3rhuR8w1f2mHxe8zp/R4B5uexzGggIhZYwVbXIeBAp7B28KGlbwg7ke jX8Ve8o25rXGkx6ENpDKFjTObnRxohOxZVbOuQJc= Date: Tue, 27 Oct 2020 14:42:33 +0100 From: Greg KH To: Matteo Croce Cc: linux-kernel@vger.kernel.org, Guenter Roeck , Petr Mladek , Arnd Bergmann , Mike Rapoport , Kees Cook , Pavel Tatashin , Robin Holt , Fabian Frederick , stable@vger.kernel.org Subject: Re: [PATCH v2 2/2] reboot: fix parsing of reboot cpu number Message-ID: <20201027134233.GB991306@kroah.com> References: <20201027133545.58625-1-mcroce@linux.microsoft.com> <20201027133545.58625-3-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201027133545.58625-3-mcroce@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 02:35:45PM +0100, Matteo Croce wrote: > From: Matteo Croce > > The kernel cmdline reboot= argument allows to specify the CPU used > for rebooting, with the syntax `s####` among the other flags, e.g. > > reboot=soft,s4 > reboot=warm,s31,force > > In the early days the parsing was done with simple_strtoul(), later > deprecated in favor of the safer kstrtoint() which handles overflow. > > But kstrtoint() returns -EINVAL if there are non-digit characters > in a string, so if this flag is not the last given, it's silently > ignored as well as the subsequent ones. > > To fix it, revert the usage of simple_strtoul(), which is no longer > deprecated, and restore the old behaviour. > > While at it, merge two identical code blocks into one. > > Fixes: 616feab75397 ("kernel/reboot.c: convert simple_strtoul to kstrtoint") > Signed-off-by: Matteo Croce > --- > kernel/reboot.c | 30 ++++++++++++------------------ > 1 file changed, 12 insertions(+), 18 deletions(-) > This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.