Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1821013imm; Mon, 3 Sep 2018 10:17:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbjYKALhHjVmH+cEKM3qi73RAh77PWABMMYsWjhfRCP711xMvvSeYlp1HmmKHCsMKuftkkg X-Received: by 2002:a17:902:b70f:: with SMTP id d15-v6mr30229020pls.53.1535995040509; Mon, 03 Sep 2018 10:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995040; cv=none; d=google.com; s=arc-20160816; b=bpiHB2NTfSOUcTKFH/TTg6AJKqm9uhqdJf0NOuEl6NmVtrWoLvhfQAhnVwEcAvx5zr xNINEZApNUnma6NId7U11YjTedNcMAGVDogf0imZR1UX3bLrpNYg3Zdxy6xF1j528h2z 2bmWlI4ljC60lgI+0J/YcC/h97/OU7KBiouepenOSQa83FrPwwEb32zgTnxgkq1afleU /VeeRu390ra0tRB722l6/tfniOU2fj1RlKuNQUcYZOZpsvN96x5A/h7cjuia5AAyxV4X YWTZ7GamCapdYU17ePqiNF4aydB5J4iFKUIX8Ng1TL2x1zrMlMTRH+E8IqHuExPsSPyp vuqg== 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=/YbKTbdDQl5eR+1ToBxLYNm8lx+96Hi6x5wI/Q5BaCw=; b=UYWB9NKVlW8xbZC4yybw1ECTub4fqCU/ETPQ2PmEarVXBULeOzDbcK+5i80gEmhzrI E8dnDwXTB7ENEArYqB+iIJfzDC13bA/VlLnc78J2VTlJ/YZG6KgJ3iPT3Eu2WuRtN4Jm K+mkCam1LXC7aB6vrQg6ydzqsgoz9C/pvvxqSxAE1SvWoeZWkQHgrQ+dNPhKnvvdTMZ4 tOQQYDFeztGT02KgQ5B0D/2/OQ6owlfDYN4FWl4/ajnEAdntr6bmxpU+eArMHgdqPWu1 lXT3yBRNbiU78dzt+rvkBSyGl97PcYjF4ewCVozL8j+yMq+Lc3lyFo+qmM488syODPAI 8VPA== 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 r84-v6si19632281pfj.355.2018.09.03.10.17.05; Mon, 03 Sep 2018 10:17:20 -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 S1729522AbeICVhH (ORCPT + 99 others); Mon, 3 Sep 2018 17:37:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42488 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727746AbeICVhG (ORCPT ); Mon, 3 Sep 2018 17:37:06 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7C0EAD06; Mon, 3 Sep 2018 17:16:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Steffen Klassert , Sasha Levin Subject: [PATCH 4.14 004/165] xfrm: free skb if nlsk pointer is NULL Date: Mon, 3 Sep 2018 18:54:50 +0200 Message-Id: <20180903165655.220856605@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 86126b77dcd551ce223e7293bb55854e3df05646 ] 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: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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 @@ -1021,10 +1021,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)