Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75e252d981c0e80c14ce90df246e9b1300474c4f
Commit:     75e252d981c0e80c14ce90df246e9b1300474c4f
Parent:     ce0ecd594d78710422599918a608e96dd1ee6024
Author:     Joy Latten <[EMAIL PROTECTED]>
AuthorDate: Mon Mar 12 17:14:07 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Mar 12 17:14:07 2007 -0700

    [XFRM]: Fix missing protocol comparison of larval SAs.
    
    I noticed that in xfrm_state_add we look for the larval SA in a few
    places without checking for protocol match. So when using both
    AH and ESP, whichever one gets added first, deletes the larval SA.
    It seems AH always gets added first and ESP is always the larval
    SA's protocol since the xfrm->tmpl has it first. Thus causing the
    additional km_query()
    
    Adding the check eliminates accidental double SA creation.
    
    Signed-off-by: Joy Latten <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/xfrm/xfrm_state.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a35f9e4..5c5f6dc 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -704,7 +704,8 @@ static struct xfrm_state *__find_acq_core(unsigned short 
family, u8 mode, u32 re
                    x->props.mode   != mode ||
                    x->props.family != family ||
                    x->km.state     != XFRM_STATE_ACQ ||
-                   x->id.spi       != 0)
+                   x->id.spi       != 0 ||
+                   x->id.proto     != proto)
                        continue;
 
                switch (family) {
@@ -801,7 +802,8 @@ int xfrm_state_add(struct xfrm_state *x)
 
        if (use_spi && x->km.seq) {
                x1 = __xfrm_find_acq_byseq(x->km.seq);
-               if (x1 && xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family)) {
+               if (x1 && ((x1->id.proto != x->id.proto) ||
+                   xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) {
                        xfrm_state_put(x1);
                        x1 = NULL;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to