This is a note to let you know that I've just added the patch titled MIPS: fw: Allow firmware to pass a empty env to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mips-fw-allow-firmware-to-pass-a-empty-env.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ee1809ed7bc456a72dc8410b475b73021a3a68d5 Mon Sep 17 00:00:00 2001 From: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> Date: Tue, 11 Apr 2023 12:14:26 +0100 Subject: MIPS: fw: Allow firmware to pass a empty env From: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> commit ee1809ed7bc456a72dc8410b475b73021a3a68d5 upstream. fw_getenv will use env entry to determine style of env, however it is legal for firmware to just pass a empty list. Check if first entry exist before running strchr to avoid null pointer dereference. Cc: stable@xxxxxxxxxxxxxxx Link: https://github.com/clbr/n64bootloader/issues/5 Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> Signed-off-by: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/fw/lib/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/fw/lib/cmdline.c +++ b/arch/mips/fw/lib/cmdline.c @@ -51,7 +51,7 @@ char *fw_getenv(char *envname) { char *result = NULL; - if (_fw_envp != NULL) { + if (_fw_envp != NULL && fw_envp(0) != NULL) { /* * Return a pointer to the given environment variable. * YAMON uses "name", "value" pairs, while U-Boot uses Patches currently in stable-queue which might be from jiaxun.yang@xxxxxxxxxxx are queue-4.19/mips-fw-allow-firmware-to-pass-a-empty-env.patch