OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][IPV4] Swap the ifa allocation with the"ipv4_devconf_setall" call
[PATCH][IPV4] Swap the ifa allocation with the"ipv4_devconf_setall" call [message #24654] Fri, 07 December 2007 09:22 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
According to Herbert, the ipv4_devconf_setall should be called
only when the ifa is added to the device. However, failed 
ifa allocation may bring things into inconsistent state.

Move the call to ipv4_devconf_setall after the ifa allocation.

Fits both net-2.6 (with offsets) and net-2.6.25 (cleanly).

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 0b5f042..1c3e20c 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -519,8 +519,6 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
 		goto errout;
 	}
 
-	ipv4_devconf_setall(in_dev);
-
 	ifa = inet_alloc_ifa();
 	if (ifa == NULL) {
 		/*
@@ -531,6 +529,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
 		goto errout;
 	}
 
+	ipv4_devconf_setall(in_dev);
 	in_dev_hold(in_dev);
 
 	if (tb[IFA_ADDRESS] == NULL)
Re: [PATCH][IPV4] Swap the ifa allocation with the"ipv4_devconf_setall" call [message #24717 is a reply to message #24654] Sat, 08 December 2007 07:55 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Fri, 07 Dec 2007 12:22:57 +0300

> According to Herbert, the ipv4_devconf_setall should be called
> only when the ifa is added to the device. However, failed 
> ifa allocation may bring things into inconsistent state.
> 
> Move the call to ipv4_devconf_setall after the ifa allocation.
> 
> Fits both net-2.6 (with offsets) and net-2.6.25 (cleanly).
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied to net-2.6, thanks Pavel.
Previous Topic: [PATCH] pid: Extend/Fix pid_vnr
Next Topic: [PATCH net-2.6.25] Remove unused devconf macros
Goto Forum:
  


Current Time: Sat Mar 25 10:40:47 GMT 2023

Total time taken to generate the page: 0.00912 seconds