This is a note to let you know that I've just added the patch titled nvmem: brcm_nvram: Add check for kzalloc to the 6.1-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: nvmem-brcm_nvram-add-check-for-kzalloc.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b0576ade3aaf24b376ea1a4406ae138e2a22b0c0 Mon Sep 17 00:00:00 2001 From: Jiasheng Jiang <jiasheng@xxxxxxxxxxx> Date: Fri, 27 Jan 2023 10:40:06 +0000 Subject: nvmem: brcm_nvram: Add check for kzalloc From: Jiasheng Jiang <jiasheng@xxxxxxxxxxx> commit b0576ade3aaf24b376ea1a4406ae138e2a22b0c0 upstream. Add the check for the return value of kzalloc in order to avoid NULL pointer dereference. Fixes: 6e977eaa8280 ("nvmem: brcm_nvram: parse NVRAM content into NVMEM cells") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx> Link: https://lore.kernel.org/r/20230127104015.23839-2-srinivas.kandagatla@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/nvmem/brcm_nvram.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/nvmem/brcm_nvram.c +++ b/drivers/nvmem/brcm_nvram.c @@ -97,6 +97,9 @@ static int brcm_nvram_parse(struct brcm_ len = le32_to_cpu(header.len); data = kzalloc(len, GFP_KERNEL); + if (!data) + return -ENOMEM; + memcpy_fromio(data, priv->base, len); data[len - 1] = '\0'; Patches currently in stable-queue which might be from jiasheng@xxxxxxxxxxx are queue-6.1/nvmem-brcm_nvram-add-check-for-kzalloc.patch