diff mbox

[ipsec] xfrm: properly handle invalid states as an error

Message ID 1369222847-8542-1-git-send-email-timo.teras@iki.fi
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Timo Teras May 22, 2013, 11:40 a.m. UTC
The error exit path needs err explicitly set. Otherwise it
returns success and the only caller, xfrm_output_resume(),
would oops in skb_dst(skb)->ops derefence as skb_dst(skb) is
NULL.

Bug introduced in commit bb65a9cb (xfrm: removes a superfluous
check and add a statistic).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Cc: Li RongQing <roy.qing.li@gmail.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
Should go also to 3.9-stable.

 net/xfrm/xfrm_output.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Miller May 23, 2013, 8:20 a.m. UTC | #1
From: Timo Teräs <timo.teras@iki.fi>
Date: Wed, 22 May 2013 14:40:47 +0300

> The error exit path needs err explicitly set. Otherwise it
> returns success and the only caller, xfrm_output_resume(),
> would oops in skb_dst(skb)->ops derefence as skb_dst(skb) is
> NULL.
> 
> Bug introduced in commit bb65a9cb (xfrm: removes a superfluous
> check and add a statistic).
> 
> Signed-off-by: Timo Teräs <timo.teras@iki.fi>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index bcfda89..0cf003d 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -64,6 +64,7 @@  static int xfrm_output_one(struct sk_buff *skb, int err)
 
 		if (unlikely(x->km.state != XFRM_STATE_VALID)) {
 			XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTSTATEINVALID);
+			err = -EINVAL;
 			goto error;
 		}