From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8BA2534389A for ; Thu, 28 May 2026 00:27:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779928070; cv=none; b=q+P1QaT1v1WMCLRIa0gcw06PEILDHsoANBUkUkuMqVueJex4Dz2KjlwI5nZWyQmMZk8SERu4jy1nu4lRjtmlGVGik+sUpvq+FCLcJoBYNlo+eCj03Q048zRWbSn5X6j7/LlgA7yzdokfgXAvnVSRGAqiitf/Bh1UB4CQy+fUeIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779928070; c=relaxed/simple; bh=k70BCV9pAdhjzFIARI+Ubawvc8FC+M1Mfj6MS2sZOAg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N31Xg5QBqzLrVLHN1SZ9AwKecP0cWaK+XRzbX80h7nmHG8yF5qQWlMJGYWoOJsy6VHpIYccU6r8/L/mgsaz0w2rR2wIW5u2VsAmw7oGa+yMRdcaOUo6XGpoBGZrutQxtdkeMDDlFzjPSTh8crS38zCt7TwBTueGESCtTZ4w7yXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=cqqrjKfV; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="cqqrjKfV" Date: Thu, 28 May 2026 02:27:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779928057; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9zKbehWNz+h1jiPCKn8iLdYzREzuzwUvF0JgyusPZ48=; b=cqqrjKfVHKY+tldoJEQJ7PN/XLmb2AxegEpURDqd/7nB2RV/Upg/fPQTRnSzNo/xsx4mzX UQvWo1JhRtLgXPfVQ7NSTppF006Bo0M5n/RWAByT9O6JoUPW4vnYc2YuVp6dIo5Rr2FjbF xHD2sNxPBf9be1SRU7DGYAg6ciC74Uo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Thorsten Blum To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Pekka Enberg , Yinghai Lu Cc: stable@vger.kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/boot: validate console=uart8250 baud rate to avoid early boot hang Message-ID: References: <20260514143014.516303-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260514143014.516303-3-thorsten.blum@linux.dev> X-Migadu-Flow: FLOW_OUT On Thu, May 14, 2026 at 04:30:15PM +0200, Thorsten Blum wrote: > When the baud rate is empty, 0, invalid, or overflows to 0 when stored > as an int, the system will hang during early boot because of a division > by zero in early_serial_init(). > > Fall back to DEFAULT_BAUD when the resulting baud rate is 0 to prevent > an early system hang. > > Fixes: ce0aa5dd20e4 ("x86, setup: Make the setup code also accept console=uart8250") > Cc: stable@vger.kernel.org > Signed-off-by: Thorsten Blum > --- > arch/x86/boot/early_serial_console.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c > index 023bf1c3de8b..28a887af430d 100644 > --- a/arch/x86/boot/early_serial_console.c > +++ b/arch/x86/boot/early_serial_console.c > @@ -117,7 +117,7 @@ static unsigned int probe_baud(int port) > static void parse_console_uart8250(void) > { > char optstr[64], *options; > - int baud = DEFAULT_BAUD; > + int baud; > int port = 0; > > /* > @@ -136,9 +136,11 @@ static void parse_console_uart8250(void) > else > return; > > - if (options && (options[0] == ',')) > - baud = simple_strtoull(options + 1, &options, 0); > - else > + if (options && (options[0] == ',')) { > + baud = simple_strtoull(options + 1, NULL, 0); > + if (!baud) > + baud = DEFAULT_BAUD; > + } else > baud = probe_baud(port); > > if (port) Gentle ping? I also tested this and verified that it works.