Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3334713imu; Sun, 11 Nov 2018 12:37:06 -0800 (PST) X-Google-Smtp-Source: AJdET5fja7cwWU4cL2sOjo/V0l38ZJyUtsm155XmZdmTK2lW8Txf6b/vFhMCCkR+Dy3VMKQxd8R0 X-Received: by 2002:a17:902:7b91:: with SMTP id w17-v6mr17010440pll.289.1541968626476; Sun, 11 Nov 2018 12:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968626; cv=none; d=google.com; s=arc-20160816; b=DgNaq5Hmtakn2kNe7V3UH2TlWBTeiuSwMuLu7S76Z1imTGhHi8xDkhyQtoyVps1Pdf HrKl5xN3ZHC6eQF50OtCOj9prmZT7aBPAzOaoVAJdJV4H1o+0N+qtVErxkTsGSmz7+7e 43Zdw9ezmhV+x0iPclzbaOMpztH9ogZJSC/W0dpVUorOuZSni9aVFLrlM2Udg3TUtmJe z0P57f1PTagRYxofqQoMvKwWmAoD69z4ttsxvQeV1pPyDDveKCDo7tMGPdoSaijJOgA1 KImjm3W549eWUBCmMm381wwmF2KRHs2yDeqakfXazjeCqlgivlO7Ut458oxhr8RvnOri nkrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=lPll/a1rQc423RfKszkkdR7QK+3F8sitvseSj/SKHJs=; b=VfffyDOCXNesMAuTrUCIPgxd75hSOwnJS+W9nYW+JZcIYjWZ4ZbSpQf184XtlcHf0E a2sW9z6yulco6JLnJCXCN3bx2zct56pxDXY/SBt0+TO/NHUgWLmSutligOeDGjHIoBa1 32A15488abrAGPmoBzwiWiOhgvePTPbh1NMOiwZpVK6L9LzOH6EggbXULZfHKpyWd6FR L5dxFE+0DnZN9HFcfv7ZaNSELKqWgaH20oqEUueU5J4gCdD7OVsYHd193M3XJzUbY+YO 1WbF6slHH4S/Lw4s/Bb0hJseAFVhIV8rgcvfvRz4UqUFu8vgXyEnqDy3cWOxDA2DKgYt jwIw== 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 h3-v6si15135650pld.424.2018.11.11.12.36.51; Sun, 11 Nov 2018 12:37:06 -0800 (PST) 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 S1730389AbeKLGZ6 (ORCPT + 99 others); Mon, 12 Nov 2018 01:25:58 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:49848 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730122AbeKLFsM (ORCPT ); Mon, 12 Nov 2018 00:48:12 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsY-0000l5-Rq; Sun, 11 Nov 2018 19:58:43 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsW-0001io-BA; Sun, 11 Nov 2018 19:58:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Sabrina Dubroca" , "Stefano Brivio" , "David S. Miller" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 248/366] skbuff: Unconditionally copy pfmemalloc in __skb_clone() In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Stefano Brivio commit e78bfb0751d4e312699106ba7efbed2bab1a53ca upstream. 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 [bwh: Backported to 3.16: We didn't set the pfmemalloc flag in either copy or clone path until now] Signed-off-by: Ben Hutchings --- --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -768,6 +768,7 @@ static struct sk_buff *__skb_clone(struc n->cloned = 1; n->nohdr = 0; n->peeked = 0; + C(pfmemalloc); n->destructor = NULL; C(tail); C(end);