Skip to contentSkip to conversation

xfrm: wrong hash value for temporary SA

PATCH Applied Nicolas Dichtel 2 participants 2 messages Apr 24, 2009 – Apr 27, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: wrong hash value for temporary SA

When kernel inserts a temporary SA for IKE, it uses the wrong hash value for dst list. Two hash values were calcultated before: one with source address and one with a wildcard source address.

Bug hinted by Junwei Zhang <[email protected]>

net/xfrm/xfrm_state.c +3 -3
index 62a5425..6ccc3cd 100644
@@ -794,7 +794,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
 {
 	static xfrm_address_t saddr_wildcard = { };
 	struct net *net = xp_net(pol);
-	unsigned int h;
+	unsigned int h, h_wildcard;
 	struct hlist_node *entry;
 	struct xfrm_state *x, *x0, *to_put;
 	int acquire_in_progress = 0;
@@ -819,8 +819,8 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
 	if (best)
 		goto found;
 
-	h = xfrm_dst_hash(net, daddr, &saddr_wildcard, tmpl->reqid, family);
-	hlist_for_each_entry(x, entry, net->xfrm.state_bydst+h, bydst) {
+	h_wildcard = xfrm_dst_hash(net, daddr, &saddr_wildcard, tmpl->reqid, family);
+	hlist_for_each_entry(x, entry, net->xfrm.state_bydst+h_wildcard, bydst) {
 		if (x->props.family == family &&
 		    x->props.reqid == tmpl->reqid &&
 		    !(x->props.flags & XFRM_STATE_WILDRECV) &&
maintainer Applied
#1 lore raw

From: Nicolas Dichtel <[email protected]>
Date: Fri, 24 Apr 2009 11:55:38 +0200

Quoted 8 lines

When kernel inserts a temporary SA for IKE, it uses the wrong hash value for dst
list. Two hash values were calcultated before: one with source address and one
with a wildcard source address.

Bug hinted by Junwei Zhang <[email protected]>

My bad.

Thanks for fixing this!

Applied.