[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190228041201.op5qv6pfgu6guv4j@gondor.apana.org.au>
Date: Thu, 28 Feb 2019 12:12:01 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Yue Haibing <yuehaibing@...wei.com>
Cc: steffen.klassert@...unet.com, davem@...emloft.net,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Fan Du <fan.du@...driver.com>
Subject: Re: [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@...driver.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@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists