mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicholas Krause <uboot477@gmail.com>
To: davem@davemloft.net
Cc: kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org,
	kaber@trash.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Nicholas Krause <xerofoify@gmail.com>
Subject: [PATCH] ipv6:Fix concurrent access issue in the function inet6_rtm_deladdr
Date: Tue,  4 Aug 2015 22:39:00 -0400	[thread overview]
Message-ID: <1438742340-28451-1-git-send-email-uboot477@gmail.com> (raw)

From: Nicholas Krause <xerofoify@gmail.com>

This fixes the issue with conncurrent access when calling the function
inte6_addr_del due to this function using non locked wrapper versions
of certain functions by locking the routing mutex before and after this
call with rtnl_lock/unlock. After the unlocking just return the error
code as normal to signal success or failure to the caller of the function
inet_6_rtm_addr.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 net/ipv6/addrconf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 21c2c81..b6103e0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4006,8 +4006,11 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
 	/* We ignore other flags so far. */
 	ifa_flags &= IFA_F_MANAGETEMPADDR;
 
-	return inet6_addr_del(net, ifm->ifa_index, ifa_flags, pfx,
+	rtnl_lock();
+	err =  inet6_addr_del(net, ifm->ifa_index, ifa_flags, pfx,
 			      ifm->ifa_prefixlen);
+	rtnl_unlock();
+	return err;
 }
 
 static int inet6_addr_modify(struct inet6_ifaddr *ifp, u32 ifa_flags,
-- 
2.1.4


             reply	other threads:[~2015-08-05  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05  2:39 Nicholas Krause [this message]
2015-08-05  3:54 ` Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438742340-28451-1-git-send-email-uboot477@gmail.com \
    --to=uboot477@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xerofoify@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®