aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cedc366505b..790de32cd7d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2829,14 +2829,20 @@ void ip_rt_multicast_event(struct in_device *in_dev)
}
#ifdef CONFIG_SYSCTL
-static int flush_delay;
-
static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
struct file *filp, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
if (write) {
+ int flush_delay;
+ static DEFINE_MUTEX(flush_mutex);
+
+ mutex_lock(&flush_mutex);
+ ctl->data = &flush_delay;
proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
+ ctl->data = NULL;
+ mutex_unlock(&flush_mutex);
+
rt_cache_flush(&init_net, flush_delay);
return 0;
}
@@ -2865,7 +2871,6 @@ ctl_table ipv4_route_table[] = {
{
.ctl_name = NET_IPV4_ROUTE_FLUSH,
.procname = "flush",
- .data = &flush_delay,
.maxlen = sizeof(int),
.mode = 0200,
.proc_handler = &ipv4_sysctl_rtcache_flush,