Commit 5310760
ipvs: fix racy memcpy in proc_do_sync_threshold
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: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Link: https://lore.kernel.org/netdev/B6988E90-0A1E-4B85-BF26-2DAF6D482433@gmail.com/
Signed-off-by: Sishuai Gong <sishuai.system@gmail.com>
Acked-by: Simon Horman <horms@kernel.org>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Florian Westphal <fw@strlen.de>1 parent 9bfab6d commit 5310760
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1876 | 1876 | | |
1877 | 1877 | | |
1878 | 1878 | | |
| 1879 | + | |
1879 | 1880 | | |
1880 | 1881 | | |
1881 | 1882 | | |
| |||
1885 | 1886 | | |
1886 | 1887 | | |
1887 | 1888 | | |
| 1889 | + | |
1888 | 1890 | | |
1889 | 1891 | | |
1890 | 1892 | | |
| |||
1894 | 1896 | | |
1895 | 1897 | | |
1896 | 1898 | | |
| 1899 | + | |
1897 | 1900 | | |
1898 | 1901 | | |
1899 | 1902 | | |
| |||
4321 | 4324 | | |
4322 | 4325 | | |
4323 | 4326 | | |
| 4327 | + | |
4324 | 4328 | | |
4325 | 4329 | | |
4326 | 4330 | | |
| |||
0 commit comments