Re: [PATCH] ipv4: fix the rcu race between free_fib_info andip_route_output_slow

From: David Miller
Date: Tue May 22 2012 - 15:15:56 EST


From: "kun.jiang" <kunx.jiang@xxxxxxxxx>
Date: Tue, 22 May 2012 17:48:53 +0800

> From: Yanmin Zhang <yanmin_zhang@xxxxxxxxxxxxxxx>
>
> We hit a kernel OOPS.
...
> In function free_fib_info, we don't reset nexthop_nh->nh_dev to NULL before releasing
> nh_dev. kfree_rcu(fi, rcu) would release the whole area.
>
> Signed-off-by: Yanmin Zhang <yanmin_zhang@xxxxxxxxxxxxxxx>
> Signed-off-by: Kun Jiang <kunx.jiang@xxxxxxxxx>

This isn't a fix. You're keeping around a pointer to a completely
released object, which is therefore illegal to dereference.

That's why we must set it to NULL, to catch such illegal accesses.
--
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/