[Devel] [PATCH RHEL7 COMMIT] ms/ipv6/addrlabel: fix ip6addrlbl_get()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 28 05:37:42 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.18
------>
commit 31bafc7c3cf4bc7b12a243583886799b99fbcd85
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Mon Dec 28 17:37:42 2015 +0400

    ms/ipv6/addrlabel: fix ip6addrlbl_get()
    
    ip6addrlbl_get() has never worked. If ip6addrlbl_hold() succeeded,
    ip6addrlbl_get() will exit with '-ESRCH'. If ip6addrlbl_hold() failed,
    ip6addrlbl_get() will use about to be free ip6addrlbl_entry pointer.
    
    Fix this by inverting ip6addrlbl_hold() check.
    
    https://jira.sw.ru/browse/PSBM-42457
    
    LKML-link: http://lkml.kernel.org/g/<1450691685-29413-1-git-send-email-aryabinin@virtuozzo.com>
    Fixes: 2a8cc6c89039 ("[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.")
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 net/ipv6/addrlabel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index b30ad37..d5c9189 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -558,7 +558,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh)
 
 	rcu_read_lock();
 	p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index);
-	if (p && ip6addrlbl_hold(p))
+	if (p && !ip6addrlbl_hold(p))
 		p = NULL;
 	lseq = ip6addrlbl_table.seq;
 	rcu_read_unlock();


More information about the Devel mailing list