[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.21] ns16550: harden positional parsing



commit afb919ff6ae38f797c162bf1c5d7b3d5abbd5e32
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Apr 20 12:26:25 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 20 12:26:25 2026 +0200

    ns16550: harden positional parsing
    
    Advancing past a character without knowing whether that's the NUL char is
    at risk of reading beyond the buffer.
    
    Fixes: 25de1f692059 ("Allow arch-specific defaults to be specified for 
ns16550")
    Reported-by: Kamil Frankowicz <kamil.frankowicz@xxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 2c43b5611ffbe35611dd391c949f7cb15e1b29e7
    master date: 2026-04-07 13:54:19 +0200
---
 xen/drivers/char/ns16550.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 96e837afe8..1f95618cf6 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1547,6 +1547,9 @@ static bool __init parse_positional(struct ns16550 *uart, 
char **str)
     {
         uart->data_bits = simple_strtoul(conf, &conf, 10);
 
+        if ( !*conf )
+            PARSE_ERR_RET("bad DPS setting");
+
         uart->parity = parse_parity_char(*conf);
 
         uart->stop_bits = simple_strtoul(conf + 1, &conf, 10);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.21



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.