{"id":808672,"url":"http://patchwork.ozlabs.org/api/patches/808672/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/5bd7a6e643340d833718722c0508474c6c3a0a3a.1504260470.git.pabeni@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":"<5bd7a6e643340d833718722c0508474c6c3a0a3a.1504260470.git.pabeni@redhat.com>","list_archive_url":null,"date":"2017-09-01T12:42:30","name":"[net] udp: fix secpath leak","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"6155a1aa612a1a3991a97413cb4d52dd5fbb1129","submitter":{"id":67312,"url":"http://patchwork.ozlabs.org/api/people/67312/?format=json","name":"Paolo Abeni","email":"pabeni@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/5bd7a6e643340d833718722c0508474c6c3a0a3a.1504260470.git.pabeni@redhat.com/mbox/","series":[{"id":1017,"url":"http://patchwork.ozlabs.org/api/series/1017/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1017","date":"2017-09-01T12:42:30","name":"[net] udp: fix secpath leak","version":1,"mbox":"http://patchwork.ozlabs.org/series/1017/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/808672/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808672/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-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=pabeni@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkJpY1JRPz9s7c\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri,  1 Sep 2017 22:44:21 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751906AbdIAMoT (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 08:44:19 -0400","from mx1.redhat.com ([209.132.183.28]:46312 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751778AbdIAMoS (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 1 Sep 2017 08:44:18 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 DF179404322;\n\tFri,  1 Sep 2017 12:44:17 +0000 (UTC)","from localhost.mxp.redhat.com (unknown [10.32.181.112])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id C1B347BB43;\n\tFri,  1 Sep 2017 12:44:16 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com DF179404322","From":"Paolo Abeni <pabeni@redhat.com>","To":"netdev@vger.kernel.org","Cc":"\"David S. Miller\" <davem@davemloft.net>,\n\tYossi Kuperman <yossiku@mellanox.com>, Paul Moore <paul@paul-moore.com>","Subject":"[PATCH net] udp: fix secpath leak","Date":"Fri,  1 Sep 2017 14:42:30 +0200","Message-Id":"<5bd7a6e643340d833718722c0508474c6c3a0a3a.1504260470.git.pabeni@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tFri, 01 Sep 2017 12:44:18 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Yossi Kuperman <yossiku@mellanox.com>\n\nAfter commit dce4551cb2ad (\"udp: preserve head state for IP_CMSG_PASSSEC\")\nwe preserve the secpath for the whole skb lifecycle, but we also\nend up leaking a reference to it.\n\nWe must clear the head state on skb reception, if secpath is\npresent.\n\nFixes: dce4551cb2ad (\"udp: preserve head state for IP_CMSG_PASSSEC\")\nSigned-off-by: Yossi Kuperman <yossiku@mellanox.com>\nSigned-off-by: Paolo Abeni <pabeni@redhat.com>\n---\n net/ipv4/udp.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c\nindex a6dc48d76a29..62344804baae 100644\n--- a/net/ipv4/udp.c\n+++ b/net/ipv4/udp.c\n@@ -1176,7 +1176,7 @@ static void udp_set_dev_scratch(struct sk_buff *skb)\n \tscratch->csum_unnecessary = !!skb_csum_unnecessary(skb);\n \tscratch->is_linear = !skb_is_nonlinear(skb);\n #endif\n-\tif (likely(!skb->_skb_refdst))\n+\tif (likely(!skb->_skb_refdst && !skb_sec_path(skb)))\n \t\tscratch->_tsize_state |= UDP_SKB_IS_STATELESS;\n }\n \n","prefixes":["net"]}