Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2257770imm; Thu, 18 Oct 2018 11:31:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV61H2FeNqhPVGHCpQBIHJQJXcygxzlOCA3RAp7D5YCqGElFCRppLBNbpE73VfLHCJYjm3fAU X-Received: by 2002:a63:8f09:: with SMTP id n9-v6mr29115499pgd.222.1539887508228; Thu, 18 Oct 2018 11:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539887508; cv=none; d=google.com; s=arc-20160816; b=c4R7/8DVqIkBxDAmf3XoGHGCWIBG0G8EFt8YiohQhU5p890qn3/pJaFvciwN8eGVqO cmzT+TMZdKLcwNWQUQG4kg/fjKDWwme8knW339DSjgp0QRPVGJDvu7HjzA7vqXYGLr7O 6/B/99kYwCmukPmwm1iTyMMyTaVVRnXgjZYKV6N0bsJld3KUMqggKQyJ2SRsFxlXVREw gEOSb27qrEFYCljDnMzL3T0htq+d8KQdfR7WnvDVffJsShekP4EJ56fEcrcEeQwrhVEK qaguTsD1At5DUzGz6jBBaihgMMp+lniOGJiIsJZ9pjn37gIN9ouXWXLCEtPqwPUPYHtE nZuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mh35NMi0scen+b8oNNdlzpArdt7gWZqDQANSJv2B3PE=; b=c2cL4kJXUmtFZR1M50O5gUgu02VhlWska1qruHvVWRz3tfnmgwD/fVyAA+vfhRCYaU dD+KwFABaV/RzKU6LOoJ5RF+ib4cGsSXCaBG9GVf9NhgB2yBz9JGzLD42Hs+tNqTozdl vT/4uoGbwM9hbybf21r/vfYWq2cKT5m35uN5p7urR0rJ3nEGwiIuB3wZHYJC14gdaVm+ 95D8977+hR4UJzecX0OHTgOEHM15zB47Y2Ga0Unkq5gI4BooVNbnl2b2zABmXnPz6g6x e4wcBh5ZdhQu+ON2ePONqqiR7axbyyf5SBUsSHn0WV9o0rldP7GPCEkjl+YC8tHk+sal vhyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qm7ZFC+f; 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 f9-v6si23393701plm.126.2018.10.18.11.31.33; Thu, 18 Oct 2018 11:31:48 -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; dkim=pass header.i=@kernel.org header.s=default header.b=qm7ZFC+f; 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 S1730307AbeJSCHk (ORCPT + 99 others); Thu, 18 Oct 2018 22:07:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726599AbeJSCHj (ORCPT ); Thu, 18 Oct 2018 22:07:39 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39D9B2145D; Thu, 18 Oct 2018 18:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885931; bh=WHdFFb6gLB3GVdQd2zP5WRuRnDjpKP6JBvfOiN2ql6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qm7ZFC+f1xaNoymiCWYt7RrRVuWCaWLbxehcCDcUmBrAFzfARRft12M3N5Gpfa+1g VlFWQfdblWsRS/F2Rmzry2W3iZ5dBbBXjRVSJXOV+WX4h5hhHGo6NHA0C7I/t3PE6/ 7NzsWdSp9y3p2emJmlAEjirstbr1etYSToPmsoa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Willem de Bruijn , syzbot , "David S. Miller" Subject: [PATCH 4.4 21/48] ipv4: fix use-after-free in ip_cmsg_recv_dstaddr() Date: Thu, 18 Oct 2018 19:54:56 +0200 Message-Id: <20181018175429.154522584@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175427.133690306@linuxfoundation.org> References: <20181018175427.133690306@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit 64199fc0a46ba211362472f7f942f900af9492fd ] Caching ip_hdr(skb) before a call to pskb_may_pull() is buggy, do not do it. Fixes: 2efd4fca703a ("ip: in cmsg IP(V6)_ORIGDSTADDR call pskb_may_pull") Signed-off-by: Eric Dumazet Cc: Willem de Bruijn Reported-by: syzbot Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ip_sockglue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -134,7 +134,6 @@ static void ip_cmsg_recv_security(struct static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) { struct sockaddr_in sin; - const struct iphdr *iph = ip_hdr(skb); __be16 *ports; int end; @@ -149,7 +148,7 @@ static void ip_cmsg_recv_dstaddr(struct ports = (__be16 *)skb_transport_header(skb); sin.sin_family = AF_INET; - sin.sin_addr.s_addr = iph->daddr; + sin.sin_addr.s_addr = ip_hdr(skb)->daddr; sin.sin_port = ports[1]; memset(sin.sin_zero, 0, sizeof(sin.sin_zero));