From: Greg Kroah-Hartman Date: Tue, 3 May 2022 14:20:25 +0000 (+0200) Subject: 5.17-stable patches X-Git-Tag: v5.4.192~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7a1e840de17e1b3dcf4ce6b13fd6f8c89f13dc2;p=thirdparty%2Fkernel%2Fstable-queue.git 5.17-stable patches added patches: tty-n_gsm-fix-sometimes-uninitialized-warning-in-gsm_dlci_modem_output.patch --- diff --git a/queue-5.17/series b/queue-5.17/series index cc1aa299a79..783b7f485f3 100644 --- a/queue-5.17/series +++ b/queue-5.17/series @@ -219,3 +219,4 @@ tty-n_gsm-fix-missing-update-of-modem-controls-after-dlci-open.patch tty-n_gsm-fix-broken-virtual-tty-handling.patch tty-n_gsm-fix-invalid-use-of-msc-in-advanced-option.patch tty-n_gsm-fix-software-flow-control-handling.patch +tty-n_gsm-fix-sometimes-uninitialized-warning-in-gsm_dlci_modem_output.patch diff --git a/queue-5.17/tty-n_gsm-fix-sometimes-uninitialized-warning-in-gsm_dlci_modem_output.patch b/queue-5.17/tty-n_gsm-fix-sometimes-uninitialized-warning-in-gsm_dlci_modem_output.patch new file mode 100644 index 00000000000..9596294e79c --- /dev/null +++ b/queue-5.17/tty-n_gsm-fix-sometimes-uninitialized-warning-in-gsm_dlci_modem_output.patch @@ -0,0 +1,55 @@ +From 19317433057dc1f2ca9a975e4e6b547282c2a5ef Mon Sep 17 00:00:00 2001 +From: Daniel Starke +Date: Mon, 25 Apr 2022 03:47:26 -0700 +Subject: tty: n_gsm: fix sometimes uninitialized warning in gsm_dlci_modem_output() + +From: Daniel Starke + +commit 19317433057dc1f2ca9a975e4e6b547282c2a5ef upstream. + +'size' may be used uninitialized in gsm_dlci_modem_output() if called with +an adaption that is neither 1 nor 2. The function is currently only called +by gsm_modem_upd_via_data() and only for adaption 2. +Properly handle every invalid case by returning -EINVAL to silence the +compiler warning and avoid future regressions. + +Fixes: c19ffe00fed6 ("tty: n_gsm: fix invalid use of MSC in advanced option") +Cc: stable@vger.kernel.org +Reported-by: kernel test robot +Signed-off-by: Daniel Starke +Link: https://lore.kernel.org/r/20220425104726.7986-1-daniel.starke@siemens.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/n_gsm.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/drivers/tty/n_gsm.c ++++ b/drivers/tty/n_gsm.c +@@ -932,18 +932,21 @@ static int gsm_dlci_modem_output(struct + { + u8 *dp = NULL; + struct gsm_msg *msg; +- int size; ++ int size = 0; + + /* for modem bits without break data */ +- if (dlci->adaption == 1) { +- size = 0; +- } else if (dlci->adaption == 2) { +- size = 1; ++ switch (dlci->adaption) { ++ case 1: /* Unstructured */ ++ break; ++ case 2: /* Unstructured with modem bits. */ ++ size++; + if (brk > 0) + size++; +- } else { ++ break; ++ default: + pr_err("%s: unsupported adaption %d\n", __func__, + dlci->adaption); ++ return -EINVAL; + } + + msg = gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype);