From 10303aeac8210bef683602b3956f8ad39d06da79 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 4 Apr 2022 09:48:20 +0200 Subject: [PATCH] 5.15-stable patches added patches: proc-bootconfig-add-null-pointer-check.patch --- ...-eaddrnotavail-when-reading-from-unb.patch | 9 ++--- ...t-msg_trunc-flag-when-reading-from-s.patch | 11 ++---- ...oc-bootconfig-add-null-pointer-check.patch | 36 +++++++++++++++++++ queue-5.15/series | 1 + 4 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 queue-5.15/proc-bootconfig-add-null-pointer-check.patch diff --git a/queue-5.15/can-isotp-return-eaddrnotavail-when-reading-from-unb.patch b/queue-5.15/can-isotp-return-eaddrnotavail-when-reading-from-unb.patch index 24b0da72203..9ac7b03d7ea 100644 --- a/queue-5.15/can-isotp-return-eaddrnotavail-when-reading-from-unb.patch +++ b/queue-5.15/can-isotp-return-eaddrnotavail-when-reading-from-unb.patch @@ -20,14 +20,12 @@ Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- - net/can/isotp.c | 4 ++++ + net/can/isotp.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/net/can/isotp.c b/net/can/isotp.c -index 9de6c3daed79..9ea179a6aeb0 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c -@@ -1045,12 +1045,16 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, +@@ -1005,12 +1005,16 @@ static int isotp_recvmsg(struct socket * { struct sock *sk = sock->sk; struct sk_buff *skb; @@ -44,6 +42,3 @@ index 9de6c3daed79..9ea179a6aeb0 100644 skb = skb_recv_datagram(sk, flags, noblock, &err); if (!skb) return err; --- -2.34.1 - diff --git a/queue-5.15/can-isotp-support-msg_trunc-flag-when-reading-from-s.patch b/queue-5.15/can-isotp-support-msg_trunc-flag-when-reading-from-s.patch index 176e7e5f9fe..fa176dc068c 100644 --- a/queue-5.15/can-isotp-support-msg_trunc-flag-when-reading-from-s.patch +++ b/queue-5.15/can-isotp-support-msg_trunc-flag-when-reading-from-s.patch @@ -19,14 +19,12 @@ Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- - net/can/isotp.c | 27 +++++++++++++++------------ + net/can/isotp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) -diff --git a/net/can/isotp.c b/net/can/isotp.c -index 9ea179a6aeb0..fabf8c66a38c 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c -@@ -1046,29 +1046,28 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, +@@ -1006,29 +1006,28 @@ static int isotp_recvmsg(struct socket * struct sock *sk = sock->sk; struct sk_buff *skb; struct isotp_sock *so = isotp_sk(sk); @@ -66,7 +64,7 @@ index 9ea179a6aeb0..fabf8c66a38c 100644 sock_recv_timestamp(msg, sk, skb); -@@ -1078,9 +1077,13 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, +@@ -1038,9 +1037,13 @@ static int isotp_recvmsg(struct socket * memcpy(msg->msg_name, skb->cb, msg->msg_namelen); } @@ -81,6 +79,3 @@ index 9ea179a6aeb0..fabf8c66a38c 100644 } static int isotp_release(struct socket *sock) --- -2.34.1 - diff --git a/queue-5.15/proc-bootconfig-add-null-pointer-check.patch b/queue-5.15/proc-bootconfig-add-null-pointer-check.patch new file mode 100644 index 00000000000..f15e0eb518a --- /dev/null +++ b/queue-5.15/proc-bootconfig-add-null-pointer-check.patch @@ -0,0 +1,36 @@ +From bed5b60bf67ccd8957b8c0558fead30c4a3f5d3f Mon Sep 17 00:00:00 2001 +From: Lv Ruyi +Date: Tue, 29 Mar 2022 10:40:04 +0000 +Subject: proc: bootconfig: Add null pointer check + +From: Lv Ruyi + +commit bed5b60bf67ccd8957b8c0558fead30c4a3f5d3f upstream. + +kzalloc is a memory allocation function which can return NULL when some +internal memory errors happen. It is safer to add null pointer check. + +Link: https://lkml.kernel.org/r/20220329104004.2376879-1-lv.ruyi@zte.com.cn + +Cc: stable@vger.kernel.org +Fixes: c1a3c36017d4 ("proc: bootconfig: Add /proc/bootconfig to show boot config list") +Acked-by: Masami Hiramatsu +Reported-by: Zeal Robot +Signed-off-by: Lv Ruyi +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + fs/proc/bootconfig.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/fs/proc/bootconfig.c ++++ b/fs/proc/bootconfig.c +@@ -32,6 +32,8 @@ static int __init copy_xbc_key_value_lis + int ret = 0; + + key = kzalloc(XBC_KEYLEN_MAX, GFP_KERNEL); ++ if (!key) ++ return -ENOMEM; + + xbc_for_each_key_value(leaf, val) { + ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX); diff --git a/queue-5.15/series b/queue-5.15/series index 93ac816fd30..722c3055414 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -860,3 +860,4 @@ vhost-handle-error-while-adding-split-ranges-to-iotlb.patch spi-fix-tegra-qspi-example.patch platform-chrome-cros_ec_typec-check-for-ec-device.patch can-isotp-restore-accidentally-removed-msg_peek-feat.patch +proc-bootconfig-add-null-pointer-check.patch -- 2.47.3