lkml.org 
[lkml]   [2019]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] xfrm: policy: Fix possible user after free in __xfrm_policy_unlink
On Thu, Feb 28, 2019 at 11:16:23AM +0800, Yue Haibing wrote:
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 8d1a898..b27eb742 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -316,6 +316,8 @@ static void xfrm_policy_timer(struct timer_list *t)
> goto out;
>
> dir = xfrm_policy_id2dir(xp->index);
> + if (dir >= XFRM_POLICY_MAX * 2)
> + dir = dir & XFRM_POLICY_MAX;

This is still wrong. We shouldn't be allowing bogus policies
to be in the system at all.

I have digged deeper and the problem was introduced by:

commit e682adf021be796940be6cc10c07be7f7398c220
Author: Fan Du <fan.du@windriver.com>
Date: Thu Nov 7 17:47:48 2013 +0800

xfrm: Try to honor policy index if it's supplied by user

Where the check for the user-supplied index is simply wrong in
verify_newpolicy_info. So please fix it there.

Thanks!
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

\
 
 \ /
  Last update: 2019-02-28 05:13    [W:0.041 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site