Re: [PATCH] Freeing dst when the reference count <0 causes general protection fault, it could be a major security flaw as rogue app can modify dst to crash kernel.

From: Hannes Frederic Sowa
Date: Sat Sep 13 2014 - 06:14:02 EST


On Sa, 2014-09-13 at 01:27 -0700, Shakil A Khan wrote:
> Signed-off-by: Shakil A Khan <shakilk1729@xxxxxxxxx>
> ---
> net/core/dst.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/dst.c b/net/core/dst.c
> index a028409..6a848b0 100644
> --- a/net/core/dst.c
> +++ b/net/core/dst.c
> @@ -284,7 +284,10 @@ void dst_release(struct dst_entry *dst)
> int newrefcnt;
>
> newrefcnt = atomic_dec_return(&dst->__refcnt);
> - WARN_ON(newrefcnt < 0);
> +
> + if (WARN(newrefcnt < 0, "dst reference count less than zero"))
> + return;
> +
> if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
> call_rcu(&dst->rcu_head, dst_destroy_rcu);
> }

So change this to a memory leak which also has reliable concerns...

You could just change this to a BUG_ON, but this will also allow a rogue
app to kill the kernel.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/