Commit d3221a16 authored by Sishuai Gong's avatar Sishuai Gong Committed by sanglipeng
Browse files

ipvs: fix racy memcpy in proc_do_sync_threshold

stable inclusion
from stable-v5.10.192
commit 49f57a9087d135542ed3de878bdf0eef9333289f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I933RF

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=49f57a9087d135542ed3de878bdf0eef9333289f

--------------------------------

[ Upstream commit 5310760a ]

When two threads run proc_do_sync_threshold() in parallel,
data races could happen between the two memcpy():

Thread-1			Thread-2
memcpy(val, valp, sizeof(val));
				memcpy(valp, val, sizeof(val));

This race might mess up the (struct ctl_table *) table->data,
so we add a mutex lock to serialize them.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/netdev/B6988E90-0A1E-4B85-BF26-2DAF6D482433@gmail.com/


Signed-off-by: default avatarSishuai Gong <sishuai.system@gmail.com>
Acked-by: default avatarSimon Horman <horms@kernel.org>
Acked-by: default avatarJulian Anastasov <ja@ssi.bg>
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 80aaf1fc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment