3.6-stable review patch.  If anyone has any objections, please let me know.

------------------


From: Julian Anastasov <j...@ssi.bg>

[ Upstream commit f8a17175c63fd3e8b573719f7538816f8c96abf4 ]

Avoid checking nh_pcpu_rth_output in fast path,
abort fib_info creation on alloc_percpu failure.

Signed-off-by: Julian Anastasov <j...@ssi.bg>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 net/ipv4/fib_semantics.c |    2 ++
 net/ipv4/route.c         |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -840,6 +840,8 @@ struct fib_info *fib_create_info(struct
        change_nexthops(fi) {
                nexthop_nh->nh_parent = fi;
                nexthop_nh->nh_pcpu_rth_output = alloc_percpu(struct rtable 
__rcu *);
+               if (!nexthop_nh->nh_pcpu_rth_output)
+                       goto failure;
        } endfor_nexthops(fi)
 
        if (cfg->fc_mx) {
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1210,8 +1210,6 @@ static bool rt_cache_route(struct fib_nh
        if (rt_is_input_route(rt)) {
                p = (struct rtable **)&nh->nh_rth_input;
        } else {
-               if (!nh->nh_pcpu_rth_output)
-                       goto nocache;
                p = (struct rtable **)__this_cpu_ptr(nh->nh_pcpu_rth_output);
        }
        orig = *p;
@@ -1226,7 +1224,6 @@ static bool rt_cache_route(struct fib_nh
                 * unsuccessful at storing this route into the cache
                 * we really need to set it.
                 */
-nocache:
                rt->dst.flags |= DST_NOCACHE;
                ret = false;
        }


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

Reply via email to