From b0dcb85864986085119a4a8ca927a1cfd7a98c16 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Mon, 26 Nov 2012 12:50:50 -0800 Subject: [PATCH] ipv4: Check if dev_out is NULL in ip_route_output_slow() Change-Id: If04a8e99942dbe7e099e736dc87c2a49e1e778f9 Signed-off-by: Dmitry Shmidt --- net/ipv4/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 6b95f74a91d3..37be8f654866 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -2751,10 +2751,15 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) res.type == RTN_UNICAST && !fl4->flowi4_oif) fib_select_default(&res); + dev_out = FIB_RES_DEV(res); + if (dev_out == NULL) { + rth = ERR_PTR(-ENODEV); + goto out; + } + if (!fl4->saddr) fl4->saddr = FIB_RES_PREFSRC(net, res); - dev_out = FIB_RES_DEV(res); fl4->flowi4_oif = dev_out->ifindex; -- 2.34.1