From patchwork Thu Sep 19 22:03:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 174105 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1600023ill; Thu, 19 Sep 2019 15:14:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOumCq+7Xvemm0YwLL8uw6PDyUT3qQm5xyCF5bYTlBcHH8AwMImPIWuuZDxphCXPD8uopK X-Received: by 2002:a17:906:5453:: with SMTP id d19mr4926940ejp.236.1568931254334; Thu, 19 Sep 2019 15:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568931254; cv=none; d=google.com; s=arc-20160816; b=eMwlgtYD529GAzTLi9C7z92nDObDkJi0L5JCZFXVopot6IdoqYZQnXYAOxyp2RBmjB VKUhcxPTIO5JvK2yOuQNsbwaGb81JGrDNz6X5NkzmeYEHwrxYf4cIQJqUestAcyZgiLw FIQVmV2W+oxW9NGZQlh5C8MnrulCTI8JbGhFyBgTOUVslPChrAStvSUoIPf+Hz42VUBB XHoncUdzkZzgngV2I1GNrK6aR1y8Kry/2T8iAbpJUK9WZjFycEt8R6u05N+l3615+FMa +l775K81YRctdVcqnJmvsOSLiCg8HDlUHW5qbnnk1kg4dDm7KNWbicssEzcZHZ7N4XUy z5Tg== 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=U2BK94GT0BQ7ZCrMpzD8n6zNCypdTf/sI2SY5YCQ5hU=; b=EcksL22Z1lfb14E7Uu1Q1qDNgKWTbCGfbaG0H/uR3GzFxoD/S1n9VlDSrZGbtnygwk TicvP16y74Hmzt8UAvNj40Zo/vXxKzFBlyjdrMRmg8/tQvCqFfhR2IVhx6JU0V1eQqPH zzS9Z6dGWbIhd16QCasw98vv/QQT41EAQNDMM5wKktQZD7PI2bc4Ys8331tXAeTNQLCD HXXkOKotevBsOlid8BcHuco9sjyoldt37dOFCApOOdvktyHZegA6KVZsTIKgOGrn6DeR fAJwfyB65q4linxXcSn/qUDwuAjTCfwdrBaNt3yOCPagpTLGbcFrtvnGw+kIeQfi15+p q8zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q0kEbRSX; 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 m55si85152edc.17.2019.09.19.15.14.14; Thu, 19 Sep 2019 15:14:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=q0kEbRSX; 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 S2392204AbfISWOM (ORCPT + 26 others); Thu, 19 Sep 2019 18:14:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:53560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392166AbfISWOK (ORCPT ); Thu, 19 Sep 2019 18:14:10 -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 0233621920; Thu, 19 Sep 2019 22:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931249; bh=Ts8e8Hns3t4/ykTZIfN892InRBKDgKoLX54YAaNvoyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q0kEbRSXD4wtRzFPMqixUeU3Av2pguI+/hInbjRAgtw2zQi3uQsjUXDlKFmaJIb0d KrokxpH+X+0vT7z3WZNxy4YXCEV48Kzw0E7XZ1I+63gOGpE/+bA0NwJXopgJ103ASK cFvbpntyZL8N91L8Vz+Zq3YhU0GsBSYlJZDLy4fY= 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 4.19 40/79] xdp: unpin xdp umem pages in error path Date: Fri, 20 Sep 2019 00:03:25 +0200 Message-Id: <20190919214811.273100959@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214807.612593061@linuxfoundation.org> References: <20190919214807.612593061@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 a3b037fbfecde..8cab91c482ff5 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c @@ -322,7 +322,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++) @@ -330,6 +330,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;