aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-02-26 02:22:42 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-26 02:22:42 -0500
commit04488734806948624dabc4514f96f14cd75b9a50 (patch)
tree74f3a3c10a7177a5f86398b83ad7bf0569fe8b89 /net
parent54831a83bfe656c4c54e287c734c6b0ccaa3719b (diff)
parentc4d49794ff2838038fd9756eae39c39a5a685833 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'net')
-rw-r--r--net/core/net-sysfs.c3
-rw-r--r--net/ipv4/devinet.c7
-rw-r--r--net/ipv6/addrconf.c16
3 files changed, 22 insertions, 4 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index fbc1c7472c5..099c753c421 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -410,7 +410,8 @@ static ssize_t wireless_show(struct device *d, char *buf,
410 const struct iw_statistics *iw; 410 const struct iw_statistics *iw;
411 ssize_t ret = -EINVAL; 411 ssize_t ret = -EINVAL;
412 412
413 rtnl_lock(); 413 if (!rtnl_trylock())
414 return restart_syscall();
414 if (dev_isalive(dev)) { 415 if (dev_isalive(dev)) {
415 iw = get_wireless_stats(dev); 416 iw = get_wireless_stats(dev);
416 if (iw) 417 if (iw)
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 014982b6156..51ca946e339 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1317,14 +1317,19 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
1317{ 1317{
1318 int *valp = ctl->data; 1318 int *valp = ctl->data;
1319 int val = *valp; 1319 int val = *valp;
1320 loff_t pos = *ppos;
1320 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); 1321 int ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
1321 1322
1322 if (write && *valp != val) { 1323 if (write && *valp != val) {
1323 struct net *net = ctl->extra2; 1324 struct net *net = ctl->extra2;
1324 1325
1325 if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) { 1326 if (valp != &IPV4_DEVCONF_DFLT(net, FORWARDING)) {
1326 if (!rtnl_trylock()) 1327 if (!rtnl_trylock()) {
1328 /* Restore the original values before restarting */
1329 *valp = val;
1330 *ppos = pos;
1327 return restart_syscall(); 1331 return restart_syscall();
1332 }
1328 if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) { 1333 if (valp == &IPV4_DEVCONF_ALL(net, FORWARDING)) {
1329 inet_forward_change(net); 1334 inet_forward_change(net);
1330 } else if (*valp) { 1335 } else if (*valp) {
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index b0d4a4b23db..1b327f15e7e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -502,8 +502,11 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old)
502 if (p == &net->ipv6.devconf_dflt->forwarding) 502 if (p == &net->ipv6.devconf_dflt->forwarding)
503 return 0; 503 return 0;
504 504
505 if (!rtnl_trylock()) 505 if (!rtnl_trylock()) {
506 /* Restore the original values before restarting */
507 *p = old;
506 return restart_syscall(); 508 return restart_syscall();
509 }
507 510
508 if (p == &net->ipv6.devconf_all->forwarding) { 511 if (p == &net->ipv6.devconf_all->forwarding) {
509 __s32 newf = net->ipv6.devconf_all->forwarding; 512 __s32 newf = net->ipv6.devconf_all->forwarding;
@@ -4042,12 +4045,15 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write,
4042{ 4045{
4043 int *valp = ctl->data; 4046 int *valp = ctl->data;
4044 int val = *valp; 4047 int val = *valp;
4048 loff_t pos = *ppos;
4045 int ret; 4049 int ret;
4046 4050
4047 ret = proc_dointvec(ctl, write, buffer, lenp, ppos); 4051 ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
4048 4052
4049 if (write) 4053 if (write)
4050 ret = addrconf_fixup_forwarding(ctl, valp, val); 4054 ret = addrconf_fixup_forwarding(ctl, valp, val);
4055 if (ret)
4056 *ppos = pos;
4051 return ret; 4057 return ret;
4052} 4058}
4053 4059
@@ -4089,8 +4095,11 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int old)
4089 if (p == &net->ipv6.devconf_dflt->disable_ipv6) 4095 if (p == &net->ipv6.devconf_dflt->disable_ipv6)
4090 return 0; 4096 return 0;
4091 4097
4092 if (!rtnl_trylock()) 4098 if (!rtnl_trylock()) {
4099 /* Restore the original values before restarting */
4100 *p = old;
4093 return restart_syscall(); 4101 return restart_syscall();
4102 }
4094 4103
4095 if (p == &net->ipv6.devconf_all->disable_ipv6) { 4104 if (p == &net->ipv6.devconf_all->disable_ipv6) {
4096 __s32 newf = net->ipv6.devconf_all->disable_ipv6; 4105 __s32 newf = net->ipv6.devconf_all->disable_ipv6;
@@ -4109,12 +4118,15 @@ int addrconf_sysctl_disable(ctl_table *ctl, int write,
4109{ 4118{
4110 int *valp = ctl->data; 4119 int *valp = ctl->data;
4111 int val = *valp; 4120 int val = *valp;
4121 loff_t pos = *ppos;
4112 int ret; 4122 int ret;
4113 4123
4114 ret = proc_dointvec(ctl, write, buffer, lenp, ppos); 4124 ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
4115 4125
4116 if (write) 4126 if (write)
4117 ret = addrconf_disable_ipv6(ctl, valp, val); 4127 ret = addrconf_disable_ipv6(ctl, valp, val);
4128 if (ret)
4129 *ppos = pos;
4118 return ret; 4130 return ret;
4119} 4131}
4120 4132