Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3284071ybb; Tue, 31 Mar 2020 02:04:34 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvX9d6rVk/uV+I2TblGJqv4CSChBkHyZCVyKKdlm8JmKbADM7eTudEVgJJRmF7FPQ8G1aXw X-Received: by 2002:aca:dc44:: with SMTP id t65mr1408846oig.176.1585645474663; Tue, 31 Mar 2020 02:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645474; cv=none; d=google.com; s=arc-20160816; b=vlw52cmhh+fGrPmkrPl/FFALKO8jYFvpMDop/lCQvG4fbBeeF/PQ+xOEbjZBztoGrt xp5NLJL7XJODQ7xAV+aoROhZlNSnshypVtu8LFT67am/b35a9WpOerq0ZY6/UmC2+C7t FC5nzufcFtCf5aaBcvX3+zi2t471B67ZCCXs0iudyXKZOaTytHZs+botuKZOO8tkr3eJ iuGzSMeBVJjSmmd5Z+4/xMSmL/FHZE1a9mCW+8eh7PGAUFC5fnu6n4lB92QJiiCO3bv5 NoJg9/f1Jydoq42/3L7XYZwCdhHyB8g4NOVT3tJCJRXUCyidurZYdg6snEBhopAQ7nfR WNRw== 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=tTVa9mddzs71sdTuGBywmnJ4Nq6dnn5LKZjhHIgiGDI=; b=I8x62gucmAvSzlmtTHwltY9Xi0IaU+UdWwEx2QyeaPD8Wf/xFo44fLXclindugvA6q VpqM0zU/oJEUHtECHqp5g16nxV/36xRW+R1VDEQT2M071iw5uydvU0hWtXFyNW4/LZkB boclJtYqlWDsu+/EY6qMJ2Te8rOKu0O8hI8Cukl6Pl4JesEDTvjpvVZhVoHZrjkffX3P kSmRBxsPe6yy3RGQu0PEtL9pJ6pwFsWu6tSxMlfF5z7ImH2+LCbrAwjeibhJh+ELj2EU di+U4PM36QaVFzZkQbJs55Oicq16ULPgJ9S75Ead02sEJuo/9jDR6vw2HTB7E4TWzAp4 3gQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="spZ86Qi/"; 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 e11si6719839oib.152.2020.03.31.02.04.22; Tue, 31 Mar 2020 02:04:34 -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="spZ86Qi/"; 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 S1730779AbgCaJDF (ORCPT + 99 others); Tue, 31 Mar 2020 05:03:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:42694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730566AbgCaJDD (ORCPT ); Tue, 31 Mar 2020 05:03:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 57BCB20B80; Tue, 31 Mar 2020 09:03:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645382; bh=gD6t3oz/Bnkm3v+I+eFaQsz569OQ/YgUwl2kZxVodm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=spZ86Qi/oCYuM/vDISUdWDvyJmMQL6E/z5eA+wi39ZYT5Pyx/yKMM8TrI4UhcnrWE /K/ornP0q4JQFTsqE31uZAXHZpAVtTrCVOKQHf2UBCv5c4FLWrJhFFDNwW1toi5Hic E5N1jCbJeHU62NR0x9nnk+d7bZ6lfJ8Hs0w/OlZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Florian Westphal , "David S. Miller" Subject: [PATCH 5.5 036/170] tcp: also NULL skb->dev when copy was needed Date: Tue, 31 Mar 2020 10:57:30 +0200 Message-Id: <20200331085427.868028952@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Florian Westphal [ Upstream commit 07f8e4d0fddbf2f87e4cefb551278abc38db8cdd ] In rare cases retransmit logic will make a full skb copy, which will not trigger the zeroing added in recent change b738a185beaa ("tcp: ensure skb->dev is NULL before leaving TCP stack"). Cc: Eric Dumazet Fixes: 75c119afe14f ("tcp: implement rb-tree based retransmit queue") Fixes: 28f8bfd1ac94 ("netfilter: Support iif matches in POSTROUTING") Signed-off-by: Florian Westphal Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_output.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2976,8 +2976,12 @@ int __tcp_retransmit_skb(struct sock *sk tcp_skb_tsorted_save(skb) { nskb = __pskb_copy(skb, MAX_TCP_HEADER, GFP_ATOMIC); - err = nskb ? tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC) : - -ENOBUFS; + if (nskb) { + nskb->dev = NULL; + err = tcp_transmit_skb(sk, nskb, 0, GFP_ATOMIC); + } else { + err = -ENOBUFS; + } } tcp_skb_tsorted_restore(skb); if (!err) {