Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5761763imm; Mon, 23 Jul 2018 05:45:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfd4LDtXHhsXfArPWxawbE4f075lEF0HzWEqfG5txeTbxEnS3RVeMcBWzqq2GFySp2iGCgE X-Received: by 2002:a17:902:68:: with SMTP id 95-v6mr12755674pla.178.1532349923096; Mon, 23 Jul 2018 05:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532349923; cv=none; d=google.com; s=arc-20160816; b=XdeL/C8AFKaKCWqds8T+KFwi13aLg6tNWWLuW4F6oMeXKjPPjw+hhCN/6hCrIicw8y c7Spdo+pajEzkApOhT7h+lE5xplj7AtDE9++zsTITeey/+J4Lz/BV8bBtDXNDgkCcB4G QfY0HAbvWlIExbz2qyQ8udoxJoy+HR5u8GHRdvuAxUmGWW0+m0NdSdONX6KB6mzQLP1k 0hSDJJt7pildcsZhSXx9DRep4DxeszJPuSXxSXDBoDzx5xj77E5OQacSb3XMkUyx8xaJ S+tWjApEOqan/L5Jl5qbveRmn8W+Eg4sDlj4YDUtIKwTXYAPqNSvxc6UsYDet3k9Drh2 di4Q== 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=PtCckza9nBvtj/dtYe8eL+ut+zEtWmimQaZ5TTlTPNI=; b=ZBHJuxNoqBCHDC2+LrimRg3Pfq/DxcwoBTGk+dqZ5Sg7thoMFlm9LJbmYYoolxW4iG dIpvqWaewTqa1KsIV2Yc1U/O4c41rOGhKKGG2s9An9eM/5PJKR6B024Quux7cqZB3LIA YjiHqauuxh3SgdUwNCeCt8ND78VD8GkvL3HPdU5IKgLFuwbq3b8t+2Ih0DGO99bggZVT tfdcM50xF0mtaRIXdj4jjL+FgaKwHO2kmxhTrmmu+JY175NKk4qKfgyvH7wKNKupH0fL swzDxLgl+3SORXd9/enyULogXOWh83SgrDts4Kz4+CJfM2wJwq1Fj3DZrrtyrDnFvnnO cI3A== 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 f200-v6si9436971pfa.164.2018.07.23.05.45.08; Mon, 23 Jul 2018 05:45:23 -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 S2388731AbeGWNoL (ORCPT + 99 others); Mon, 23 Jul 2018 09:44:11 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47666 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388242AbeGWNoK (ORCPT ); Mon, 23 Jul 2018 09:44:10 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B26F740B; Mon, 23 Jul 2018 12:43:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sabrina Dubroca , Stefano Brivio , "David S. Miller" Subject: [PATCH 4.4 016/107] skbuff: Unconditionally copy pfmemalloc in __skb_clone() Date: Mon, 23 Jul 2018 14:41:10 +0200 Message-Id: <20180723122413.672622999@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefano Brivio [ Upstream commit e78bfb0751d4e312699106ba7efbed2bab1a53ca ] Commit 8b7008620b84 ("net: Don't copy pfmemalloc flag in __copy_skb_header()") introduced a different handling for the pfmemalloc flag in copy and clone paths. In __skb_clone(), now, the flag is set only if it was set in the original skb, but not cleared if it wasn't. This is wrong and might lead to socket buffers being flagged with pfmemalloc even if the skb data wasn't allocated from pfmemalloc reserves. Copy the flag instead of ORing it. Reported-by: Sabrina Dubroca Fixes: 8b7008620b84 ("net: Don't copy pfmemalloc flag in __copy_skb_header()") Signed-off-by: Stefano Brivio Tested-by: Sabrina Dubroca Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -828,8 +828,7 @@ static struct sk_buff *__skb_clone(struc n->cloned = 1; n->nohdr = 0; n->peeked = 0; - if (skb->pfmemalloc) - n->pfmemalloc = 1; + C(pfmemalloc); n->destructor = NULL; C(tail); C(end);