public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kobject_uevent: Fix OOB access within zap_modalias_env()
@ 2024-05-24  4:20 Zijun Hu
  2024-05-24  4:33 ` Greg KH
  2024-06-30 15:08 ` Zhou congjie
  0 siblings, 2 replies; 11+ messages in thread
From: Zijun Hu @ 2024-05-24  4:20 UTC (permalink / raw)
  To: gregkh, rafael, akpm, dmitry.torokhov; +Cc: linux-kernel, stable, Zijun Hu

zap_modalias_env() wrongly calculates size of memory block
to move, so maybe cause OOB memory access issue, fixed by
correcting size to memmove.

Fixes: 9b3fa47d4a76 ("kobject: fix suppressing modalias in uevents delivered over netlink")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 lib/kobject_uevent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 03b427e2707e..f153b4f9d4d9 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -434,7 +434,7 @@ static void zap_modalias_env(struct kobj_uevent_env *env)
 
 		if (i != env->envp_idx - 1) {
 			memmove(env->envp[i], env->envp[i + 1],
-				env->buflen - len);
+				env->buf + env->buflen - env->envp[i + 1]);
 
 			for (j = i; j < env->envp_idx - 1; j++)
 				env->envp[j] = env->envp[j + 1] - len;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-07-04 14:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-24  4:20 [PATCH] kobject_uevent: Fix OOB access within zap_modalias_env() Zijun Hu
2024-05-24  4:33 ` Greg KH
2024-05-24  5:15   ` quic_zijuhu
2024-05-24  5:21     ` Greg KH
2024-05-24  5:34       ` quic_zijuhu
2024-05-24  6:56         ` Greg KH
2024-05-24  9:08           ` quic_zijuhu
2024-05-24 11:47             ` Greg KH
2024-05-24 14:46               ` quic_zijuhu
2024-06-30 15:08 ` Zhou congjie
2024-07-04 14:01   ` quic_zijuhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox