This is a note to let you know that I've just added the patch titled tipc: check for null after calling kmemdup to the 5.10-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: tipc-check-for-null-after-calling-kmemdup.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3e6db079751afd527bf3db32314ae938dc571916 Mon Sep 17 00:00:00 2001 From: Tadeusz Struk <tadeusz.struk@xxxxxxxxxx> Date: Mon, 15 Nov 2021 08:01:43 -0800 Subject: tipc: check for null after calling kmemdup From: Tadeusz Struk <tadeusz.struk@xxxxxxxxxx> commit 3e6db079751afd527bf3db32314ae938dc571916 upstream. kmemdup can return a null pointer so need to check for it, otherwise the null key will be dereferenced later in tipc_crypto_key_xmit as can be seen in the trace [1]. Cc: tipc-discussion@xxxxxxxxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx # 5.15, 5.14, 5.10 [1] https://syzkaller.appspot.com/bug?id=bca180abb29567b189efdbdb34cbf7ba851c2a58 Reported-by: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Signed-off-by: Tadeusz Struk <tadeusz.struk@xxxxxxxxxx> Acked-by: Ying Xue <ying.xue@xxxxxxxxxxxxx> Acked-by: Jon Maloy <jmaloy@xxxxxxxxxx> Link: https://lore.kernel.org/r/20211115160143.5099-1-tadeusz.struk@xxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/tipc/crypto.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/tipc/crypto.c +++ b/net/tipc/crypto.c @@ -590,6 +590,10 @@ static int tipc_aead_init(struct tipc_ae tmp->cloned = NULL; tmp->authsize = TIPC_AES_GCM_TAG_SIZE; tmp->key = kmemdup(ukey, tipc_aead_key_size(ukey), GFP_KERNEL); + if (!tmp->key) { + tipc_aead_free(&tmp->rcu); + return -ENOMEM; + } memcpy(&tmp->salt, ukey->key + keylen, TIPC_AES_GCM_SALT_SIZE); atomic_set(&tmp->users, 0); atomic64_set(&tmp->seqno, 0); Patches currently in stable-queue which might be from tadeusz.struk@xxxxxxxxxx are queue-5.10/tipc-check-for-null-after-calling-kmemdup.patch