Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3325192imu; Sun, 11 Nov 2018 12:24:37 -0800 (PST) X-Google-Smtp-Source: AJdET5cV+UomMVC10y0fBq1mGQPU/XwOQhmerbmf+aVor0XDpPmHhCK87yGWkIm5I6lz5/OQyg0r X-Received: by 2002:a63:235f:: with SMTP id u31mr14919966pgm.122.1541967877348; Sun, 11 Nov 2018 12:24:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967877; cv=none; d=google.com; s=arc-20160816; b=coSiqizSpt1JRo9wrKaK/Ek9NkolmB0OsKXwoPWGbygSsLxXRVEaz9rx169ETBJpXI OGlAfWmZz1aljlCA2gSGi7Tbr6Jd2yNehaIClU3YDvMfvBmMw9qhqhVrDB3n7ae4j2pV sKnTL3WzXP3y/nNFQolLBVCHDVMQ0Y6P7RiS473kL5hoQ5VsxP0pv6wlOumxgyKxZ241 M6CeRNHMeS9bN2UdTkuv5CmTddnFsEekkj8DOA0vF8VhTP708HmAAKrwfEuaPYRuB/r9 DS7Ny/6IaT6wrY6GlgqndWRrwkrw5LwM5/Yo3q5rW1Dy7s28ADK0Po5M6ehj+YJqjGux +hfA== 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=ZdqjEeIEiR2uulE2T4EaI/og9OB5LYYa8ZA1axQyrM8=; b=1LLlxiorFWVnil98vnWX57vb7k5QHcn4KdFbpyFKDrmdfXgoXctcFpAsFEweq+qzRv GoYfCOsse4Y8T364yoF4NrpG8EfsdtnfoqNnFIK6h4g7ZvJiW1ZvoIPEYYokRGsO/1dz q50xO6MvDDzwbTaOYSJH9bi6xn9dFnMmDRUks8Qn1ChgoQSu6iDeAuJeHvs2bUDon6sm GkEoUmdZLaaslhvP2pRyN7PHD5CVzOZ/MnD+iINXKjYPTQppKMz4lcXOQG7iaCZ37rbZ ugFr3FmMDnokaCHbGGzoEOlDxCfHT2+sbafQhs0Izf/S9pjwBgpRzPTMVJ4I//v11/e8 0R7g== 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 f39-v6si15988557plb.149.2018.11.11.12.24.22; Sun, 11 Nov 2018 12:24:37 -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 S1731747AbeKLGJ4 (ORCPT + 99 others); Mon, 12 Nov 2018 01:09:56 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:53488 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbeKLGJz (ORCPT ); Mon, 12 Nov 2018 01:09:55 -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-0000l8-6y; Sun, 11 Nov 2018 19:59:08 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsU-0001dK-8S; Sun, 11 Nov 2018 19:58:38 +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, "Florian Westphal" , "Steffen Klassert" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 195/366] xfrm: free skb if nlsk pointer is NULL 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: Florian Westphal commit 86126b77dcd551ce223e7293bb55854e3df05646 upstream. nlmsg_multicast() always frees the skb, so in case we cannot call it we must do that ourselves. Fixes: 21ee543edc0dea ("xfrm: fix race between netns cleanup and state expire notification") Signed-off-by: Florian Westphal Signed-off-by: Steffen Klassert Signed-off-by: Ben Hutchings --- net/xfrm/xfrm_user.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -959,10 +959,12 @@ static inline int xfrm_nlmsg_multicast(s { struct sock *nlsk = rcu_dereference(net->xfrm.nlsk); - if (nlsk) - return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC); - else - return -1; + if (!nlsk) { + kfree_skb(skb); + return -EPIPE; + } + + return nlmsg_multicast(nlsk, skb, pid, group, GFP_ATOMIC); } static inline size_t xfrm_spdinfo_msgsize(void)