diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a82a11747b3f14c4567a6d8072dfc2f77421547a..0fcac8e7a2b2fb9fdb9f74bdcadf32bd177ceb39 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1914,7 +1914,8 @@ out: return err; } } - rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type, + rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev, + flags | RTCF_LOCAL, res.type, IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); if (!rth) goto e_nobufs;