>-----Original Message----- >From: [email protected] [mailto:[email protected]] >Sent: Wednesday, April 29, 2015 8:43 AM >To: [email protected] >Cc: Du, Fan; [email protected] >Subject: [PATCH] xfrm: fix a race in xfrm_state_lookup_byspi > >From: Li RongQing <[email protected]> > >The returned xfrm_state should be hold before unlock xfrm_state_lock, >otherwise the returned xfrm_state maybe be released. > >Fixes: c454997e6[{pktgen, xfrm} Introduce xfrm_state_lookup_byspi..] >Cc: Fan Du <[email protected]> >Signed-off-by: Li RongQing <[email protected]>
Acked-by: Fan Du <[email protected]> >--- > net/xfrm/xfrm_state.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c >index f5e39e3..96688cd 100644 >--- a/net/xfrm/xfrm_state.c >+++ b/net/xfrm/xfrm_state.c >@@ -927,8 +927,8 @@ struct xfrm_state *xfrm_state_lookup_byspi(struct net >*net, __be32 spi, > x->id.spi != spi) > continue; > >- spin_unlock_bh(&net->xfrm.xfrm_state_lock); > xfrm_state_hold(x); >+ spin_unlock_bh(&net->xfrm.xfrm_state_lock); > return x; > } > spin_unlock_bh(&net->xfrm.xfrm_state_lock); >-- >2.1.0 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
