|
@@ -603,13 +603,14 @@ xfrm_state_flush_secctx_check(struct net *net, u8 proto, struct xfrm_audit *audi
|
|
|
|
|
|
int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info)
|
|
int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info)
|
|
{
|
|
{
|
|
- int i, err = 0;
|
|
|
|
|
|
+ int i, err = 0, cnt = 0;
|
|
|
|
|
|
spin_lock_bh(&xfrm_state_lock);
|
|
spin_lock_bh(&xfrm_state_lock);
|
|
err = xfrm_state_flush_secctx_check(net, proto, audit_info);
|
|
err = xfrm_state_flush_secctx_check(net, proto, audit_info);
|
|
if (err)
|
|
if (err)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
|
|
+ err = -ESRCH;
|
|
for (i = 0; i <= net->xfrm.state_hmask; i++) {
|
|
for (i = 0; i <= net->xfrm.state_hmask; i++) {
|
|
struct hlist_node *entry;
|
|
struct hlist_node *entry;
|
|
struct xfrm_state *x;
|
|
struct xfrm_state *x;
|
|
@@ -626,13 +627,16 @@ restart:
|
|
audit_info->sessionid,
|
|
audit_info->sessionid,
|
|
audit_info->secid);
|
|
audit_info->secid);
|
|
xfrm_state_put(x);
|
|
xfrm_state_put(x);
|
|
|
|
+ if (!err)
|
|
|
|
+ cnt++;
|
|
|
|
|
|
spin_lock_bh(&xfrm_state_lock);
|
|
spin_lock_bh(&xfrm_state_lock);
|
|
goto restart;
|
|
goto restart;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- err = 0;
|
|
|
|
|
|
+ if (cnt)
|
|
|
|
+ err = 0;
|
|
|
|
|
|
out:
|
|
out:
|
|
spin_unlock_bh(&xfrm_state_lock);
|
|
spin_unlock_bh(&xfrm_state_lock);
|