diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2a57566e6e91..8197b06d9aaa 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1902,7 +1902,8 @@ local_input: } } - 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;