Commit c1f33e8e authored by James Morris's avatar James Morris Committed by David S. Miller

[IPSEC]: Fix parsing of 16-bit ipcomp cpi.

parent 05417c09
......@@ -39,7 +39,7 @@ static int xfrm_parse_spi(struct sk_buff *skb, u32 *spi, u32 *seq)
case IPPROTO_COMP:
if (!pskb_may_pull(skb, 4))
return -EINVAL;
*spi = *(u16*)(skb->h.raw + 2);
*spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
*seq = 0;
return 0;
default:
......@@ -188,7 +188,7 @@ static int xfrm6_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
case IPPROTO_COMP:
if (!pskb_may_pull(skb, 4))
return -EINVAL;
*spi = *(u16*)(skb->h.raw + 2);
*spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
*seq = 0;
return 0;
default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment