Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1115233imm; Wed, 1 Aug 2018 10:25:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe5gvXY+hTu8lTjgLkXrYplskCkobkc9jkjOwrYz+WRIiVuqJL6XJkZKRfzu1wdPFSzC2tu X-Received: by 2002:a63:f206:: with SMTP id v6-v6mr25494901pgh.319.1533144346601; Wed, 01 Aug 2018 10:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144346; cv=none; d=google.com; s=arc-20160816; b=ylOoVTU4W3pzzr2awsnv3PHNnXJwxmAaI/vV/2JoFTYTk4p0wVhZcckeZirnDwz3PY S07xi0uukv0eSKpYgiIT7qIZy6U3wCGPiBbTjyQl4dTY0mquB+DdD8HK+StXht7S1I4f kn2OzihcrFiPHrtc/67FbWHyv4LVJrFLX9bQI4ozEloTkuMgtfbQaUBgOzOxJclJGLob mZmBcUmST+7wweinLVzRWgZnMPo1HWDNZFO0DuMS+KI5rIEvOhbQU8Kz8bfAUNSnz+kZ WY0oVSA4ut4M3FMYDoiytHU5eBC6Rp/0jQyFWl4vYCGQdrFIOVr0SX//DZ0/rS9gPSb1 qnNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=pQJgNetS/fD8zOweteXXgJ4q6nZwACqZmNs4ZCpmVvI=; b=fuEl9xClSbSHeE8twiUIIsyAjH7XlhtSqufyFt5B3EtFCgJz7wc+l9lTUNSDhxmIMR WWJNuo/ZvKZz3y0lkWVFHIuVmH0ucADH2cbQpg8NiIyEJFodybDMVlS9Uke6g0V2HK2q ZkLNXH0IuRBEDbDpDvnRJvoe6ykalOKPzLbjw4BGR9q1SGG4tfpSb/9GRsNI0Y/rI7Pc jzp6gvJ5FmEQVJJIya2GUJUxnbLWuR3nmLW6qhRmS2ebeXCYa8b+MaETBX73O1fTiNM4 Gnz6Ad3gtiCLQu7txNEicZH/+eqCxWKYCBoN1qGzOJyPWRaiT36+ZMvMAk8KX98N5shc F7Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19-v6si14340796pgv.383.2018.08.01.10.25.31; Wed, 01 Aug 2018 10:25:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406515AbeHATK6 (ORCPT + 99 others); Wed, 1 Aug 2018 15:10:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51098 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389832AbeHATK4 (ORCPT ); Wed, 1 Aug 2018 15:10:56 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3C3DDCC3; Wed, 1 Aug 2018 17:24:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , "David S. Miller" Subject: [PATCH 4.14 232/246] ipv4: remove BUG_ON() from fib_compute_spec_dst Date: Wed, 1 Aug 2018 18:52:22 +0200 Message-Id: <20180801165022.827888715@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lorenzo Bianconi [ Upstream commit 9fc12023d6f51551d6ca9ed7e02ecc19d79caf17 ] Remove BUG_ON() from fib_compute_spec_dst routine and check in_dev pointer during flowi4 data structure initialization. fib_compute_spec_dst routine can be run concurrently with device removal where ip_ptr net_device pointer is set to NULL. This can happen if userspace enables pkt info on UDP rx socket and the device is removed while traffic is flowing Fixes: 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper") Signed-off-by: Lorenzo Bianconi Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/fib_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -282,19 +282,19 @@ __be32 fib_compute_spec_dst(struct sk_bu return ip_hdr(skb)->daddr; in_dev = __in_dev_get_rcu(dev); - BUG_ON(!in_dev); net = dev_net(dev); scope = RT_SCOPE_UNIVERSE; if (!ipv4_is_zeronet(ip_hdr(skb)->saddr)) { + bool vmark = in_dev && IN_DEV_SRC_VMARK(in_dev); struct flowi4 fl4 = { .flowi4_iif = LOOPBACK_IFINDEX, .flowi4_oif = l3mdev_master_ifindex_rcu(dev), .daddr = ip_hdr(skb)->saddr, .flowi4_tos = RT_TOS(ip_hdr(skb)->tos), .flowi4_scope = scope, - .flowi4_mark = IN_DEV_SRC_VMARK(in_dev) ? skb->mark : 0, + .flowi4_mark = vmark ? skb->mark : 0, }; if (!fib_lookup(net, &fl4, &res, 0)) return FIB_RES_PREFSRC(net, res);