diff options
author | fernando@oss.ntt.co <fernando@oss.ntt.co> | 2008-10-23 00:27:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-31 03:06:03 -0400 |
commit | a432226614c5616e3cfd211e0acffa0acfb4770c (patch) | |
tree | 2189d97e001e8ad9173ec40c27f6a28ab109db2f | |
parent | 3a8af722495469e9c550386b910c5b93c91cf107 (diff) |
xfrm: do not leak ESRCH to user space
I noticed that, under certain conditions, ESRCH can be leaked from the
xfrm layer to user space through sys_connect. In particular, this seems
to happen reliably when the kernel fails to resolve a template either
because the AF_KEY receive buffer being used by racoon is full or
because the SA entry we are trying to use is in XFRM_STATE_EXPIRED
state.
However, since this could be a transient issue it could be argued that
EAGAIN would be more appropriate. Besides this error code is not even
documented in the man page for sys_connect (as of man-pages 3.07).
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 832b47c1de80..25872747762c 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1251,6 +1251,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl, | |||
1251 | -EINVAL : -EAGAIN); | 1251 | -EINVAL : -EAGAIN); |
1252 | xfrm_state_put(x); | 1252 | xfrm_state_put(x); |
1253 | } | 1253 | } |
1254 | else if (error == -ESRCH) | ||
1255 | error = -EAGAIN; | ||
1254 | 1256 | ||
1255 | if (!tmpl->optional) | 1257 | if (!tmpl->optional) |
1256 | goto fail; | 1258 | goto fail; |