From patchwork Thu Sep 19 22:02:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 174100 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1593575ill; Thu, 19 Sep 2019 15:08:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJe2kpGDd/3+zTXljJR0y7bWm3ekKYzaQgn5f1EAccxa9cQkIebVMmot426Y6UziwNeBrm X-Received: by 2002:aa7:c897:: with SMTP id p23mr15259080eds.199.1568930904110; Thu, 19 Sep 2019 15:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568930904; cv=none; d=google.com; s=arc-20160816; b=aBY5ZRlXKAPm+Ey6KugGnywm6RBlD8xxwhpsMRfSDupgeNnCN1kiOVWy4oJAIQ+CEz NC7hBH/ZBRJGvQYQVB4gVsCe0fmZmDQKAPhUAl4TYtncJmJt0f5Ro9oPqW07g2IV/c45 tLtnjP42dglKD7Waxjs8h10017+iQa6QxQ+c4cr4C2Fu58X8RIZisOi+0J6yygv3dt1+ xD4ZRvro8GWYsE5qE+neZfeqJd0f8DPH1/H+UfhizJxDNb43wu4rc+VFapw2s+PQxHkJ k5U3ys+tt2uRHgmOcKHZjh4EoAD1/WZxjyFBilKobr28AnjvDZl05ALNII+Mr5nOjMcF YavA== 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=zmiOut2LojfKJXD6qYc//kklkwJbT3qPJbVDIWSD96w=; b=f0wzHdIGcWZZ3lWOQumUZTrSnLNeZ4v9f/QSuVLROUC7j2ocVH/KsEyc2TcGCcPLlj sWV28uaekTJTKJgXbVVxs2/Zt81JZVE+CsboGECBrNpYPYM8OggGfSvymF8ZlV6+Bjfx VQiG9TsrbCN6ihIT0D7CEspDn88Qxmky+gtqMgZji0ZUfU8gpg5bLBkEo0uPazvsOAjl tMPONYbFhy/8aotuTKpoq1GXqYEFt2AmR3/3UhfQ9xBpYeCEAXnHfOWX83XQ4qxFkDsL j/HFS48omVhFDezMvzbz8hd5kfYLnrLLcvYIVXRMzTiPO+Y6PJaqdx89nYhSjVmI9lGP RvMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FpicqyFA; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 j6si5231075ejm.157.2019.09.19.15.08.23; Thu, 19 Sep 2019 15:08:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=FpicqyFA; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393384AbfISWIV (ORCPT + 14 others); Thu, 19 Sep 2019 18:08:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:46252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393402AbfISWIV (ORCPT ); Thu, 19 Sep 2019 18:08:21 -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 C258821928; Thu, 19 Sep 2019 22:08:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568930900; bh=BJV4xn+dCqPEYrNnYRxOCtNh4EYW7nfGMGy0JjAm954=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FpicqyFAD+P8riHC88Y8TizX8prVdJoBWcL/qoTtMgunuKSc6h9YEoGc2Ne7OsImf +YZ1Dv7/TuHP9McA05U7JTLR6iRDl0VaApRMWnbJoErf/CcI+rdAnNJFnt0XybkcI4 iV1SN/QJL8LG3ArQSb2LcUkgxjks5+RrZMl+6lBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Khoronzhuk , Jonathan Lemon , Daniel Borkmann , Sasha Levin Subject: [PATCH 5.2 055/124] xdp: unpin xdp umem pages in error path Date: Fri, 20 Sep 2019 00:02:23 +0200 Message-Id: <20190919214821.003628809@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ivan Khoronzhuk [ Upstream commit fb89c39455e4b49881c5a42761bd71f03d3ef888 ] Fix mem leak caused by missed unpin routine for umem pages. Fixes: 8aef7340ae9695 ("xsk: introduce xdp_umem_page") Signed-off-by: Ivan Khoronzhuk Acked-by: Jonathan Lemon Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- net/xdp/xdp_umem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index 9c6de4f114f84..9bd7b96027c12 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c @@ -368,7 +368,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) umem->pages = kcalloc(umem->npgs, sizeof(*umem->pages), GFP_KERNEL); if (!umem->pages) { err = -ENOMEM; - goto out_account; + goto out_pin; } for (i = 0; i < umem->npgs; i++) @@ -376,6 +376,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr) return 0; +out_pin: + xdp_umem_unpin_pages(umem); out_account: xdp_umem_unaccount_pages(umem); return err;