{"id":808301,"url":"http://patchwork.ozlabs.org/api/patches/808301/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/c4d8970306e614ac139cf2f33ab5e6bb73b30154.1504194307.git.sbrivio@redhat.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<c4d8970306e614ac139cf2f33ab5e6bb73b30154.1504194307.git.sbrivio@redhat.com>","list_archive_url":null,"date":"2017-08-31T16:11:41","name":"[net] ipv4: Don't override return code from ip_route_input_noref()","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"fdf5f927988cd1a22d3a06cfc427cbd65ad40450","submitter":{"id":72032,"url":"http://patchwork.ozlabs.org/api/people/72032/?format=json","name":"Stefano Brivio","email":"sbrivio@redhat.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/c4d8970306e614ac139cf2f33ab5e6bb73b30154.1504194307.git.sbrivio@redhat.com/mbox/","series":[{"id":866,"url":"http://patchwork.ozlabs.org/api/series/866/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=866","date":"2017-08-31T16:11:41","name":"[net] ipv4: Don't override return code from ip_route_input_noref()","version":1,"mbox":"http://patchwork.ozlabs.org/series/866/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808301/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808301/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=sbrivio@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjnTF1HXFz9sPm\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 02:12:33 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751781AbdHaQMb (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 12:12:31 -0400","from mx1.redhat.com ([209.132.183.28]:58380 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751662AbdHaQMa (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tThu, 31 Aug 2017 12:12:30 -0400","from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 3543E81DFD;\n\tThu, 31 Aug 2017 16:12:30 +0000 (UTC)","from elisabeth.redhat.com (unknown [10.33.36.99])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id B23A9A8437;\n\tThu, 31 Aug 2017 16:12:28 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 3543E81DFD","From":"Stefano Brivio <sbrivio@redhat.com>","To":"\"David S . Miller\" <davem@davemloft.net>, netdev@vger.kernel.org","Cc":"Sabrina Dubroca <sdubroca@redhat.com>, Wei Wang <weiwan@google.com>","Subject":"[PATCH net] ipv4: Don't override return code from\n\tip_route_input_noref()","Date":"Thu, 31 Aug 2017 18:11:41 +0200","Message-Id":"<c4d8970306e614ac139cf2f33ab5e6bb73b30154.1504194307.git.sbrivio@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.12","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tThu, 31 Aug 2017 16:12:30 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"After ip_route_input() calls ip_route_input_noref(), another\ncheck on skb_dst() is done, but if this fails, we shouldn't\noverride the return code from ip_route_input_noref(), as it\ncould have been more specific (i.e. -EHOSTUNREACH).\n\nThis also saves one call to skb_dst_force_safe() and one to\nskb_dst() in case the ip_route_input_noref() check fails.\n\nReported-by: Sabrina Dubroca <sdubroca@redhat.com>\nFixes: ad65a2f05695 (\"ipv4: call dst_hold_safe() properly\")\nSigned-off-by: Stefano Brivio <sbrivio@redhat.com>\n---\n include/net/route.h | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)","diff":"diff --git a/include/net/route.h b/include/net/route.h\nindex cb0a76d9dde1..1b09a9368c68 100644\n--- a/include/net/route.h\n+++ b/include/net/route.h\n@@ -189,10 +189,11 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,\n \n \trcu_read_lock();\n \terr = ip_route_input_noref(skb, dst, src, tos, devin);\n-\tif (!err)\n+\tif (!err) {\n \t\tskb_dst_force_safe(skb);\n-\tif (!skb_dst(skb))\n-\t\terr = -EINVAL;\n+\t\tif (!skb_dst(skb))\n+\t\t\terr = -EINVAL;\n+\t}\n \trcu_read_unlock();\n \n \treturn err;\n","prefixes":["net"]}