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; From patchwork Thu Sep 19 22:03: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: 174103 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1596652ill; Thu, 19 Sep 2019 15:11:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz8INH6tn/CTcDlI0k9WAfCBxdYPjVgDvv9kiDXAmfdmGMWYWKlMVDRGiH6LoR3myAlxSw X-Received: by 2002:aa7:c80e:: with SMTP id a14mr18532401edt.205.1568931066470; Thu, 19 Sep 2019 15:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568931066; cv=none; d=google.com; s=arc-20160816; b=nv8xJbPvVTnRh1u6T7UIx5AHZiLp6D7XPxc1e7AihjHYwBNSmT4m9C+RwqC3AP2mFp bs4HQT+nRHwazN2juugAqUi4yfzIBqsvRFlS8F4rc4olAtvQIVXzlvFS3wCFFybMCdD8 hOA2/X8XsfH9CX56Lsk08kQObSA6HXg3Z8/Cu8Q/nEg4UaI6rPI9t9TdMXlJCUtPdqJt yMXQx9EpI4vjKJ4fVcqYuL2i7J+IKppbHUrKQu2rA8uA8M9V37kG+3LE7s2Ff0SBDPzT R+YRJP9m6tQ+zwS4NBeLm4rc5nR4/V14Vn0+uhoM8B+aWJwSOwT4pYdeLwrSh8+qpl6n cPMw== 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=Pcn+GOKTNWrFwjXk7v1m0P6r9iL/hVUDzvnxgWCwqvo=; b=NFB3IQDqhlblHxUHxDlh+ToeynKYNOR0c+Ao37VTiU7UKIX6rsbrccQ+0/RHtcrUjH WP5lStG/qRzRZjCcDLlhRfDO2VU80fDSra9MfmrCWvIfJxzUyFAs1HNcmSR+kPtOw8Qs wouUPM/1zWYHSIE5/uULcVBl265RVpzIsAHyQiJI8AGDlMb9xQWecOwIr8Cpt3z3ly4y QfPAzT8uU6d1lKxIYWfb+LuhfIgX8rfwVfWxNi0HLsKOE6ADRzn07Fyl/4/9kG1HxqPt yBssviBREkdQ0oq1YkNVScK1r8sODWexUUdDop7SgWlr9znj9TO2nIzKgwoye4kgX7oh knkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TTvvfKOZ; 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 e14si78768eda.104.2019.09.19.15.11.06; Thu, 19 Sep 2019 15:11:06 -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=TTvvfKOZ; 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 S2405837AbfISWLF (ORCPT + 14 others); Thu, 19 Sep 2019 18:11:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405830AbfISWLE (ORCPT ); Thu, 19 Sep 2019 18:11:04 -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 082EB21920; Thu, 19 Sep 2019 22:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931063; bh=sjobayxK8BQV7kAzsBZ5thsoTl6H6cbirtCozGkDE30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTvvfKOZ0ylUnD5G4TN/8oKr3zVDpD8/Zj9KjRAXkIp+b/V3SjWMAkCbUtGhQ3UCD leV2U38QxZry5l776hMM/Mpw7IciJvTOO4f5viBJ2HturQHrg7gZgEpVYwLOqcRqyl UiQZLrH535tYKWRQ3voW5XPs6k2ZT1rIE3SxAilE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baolin Wang , Vinod Koul , Sasha Levin Subject: [PATCH 5.2 115/124] dmaengine: sprd: Fix the DMA link-list configuration Date: Fri, 20 Sep 2019 00:03:23 +0200 Message-Id: <20190919214823.367143978@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: Baolin Wang [ Upstream commit 689379c2f383b1fdfdff03e84cf659daf62f2088 ] For the Spreadtrum DMA link-list mode, when the DMA engine got a slave hardware request, which will trigger the DMA engine to load the DMA configuration from the link-list memory automatically. But before the slave hardware request, the slave will get an incorrect residue due to the first node used to trigger the link-list was configured as the last source address and destination address. Thus we should make sure the first node was configured the start source address and destination address, which can fix this issue. Fixes: 4ac695464763 ("dmaengine: sprd: Support DMA link-list mode") Signed-off-by: Baolin Wang Link: https://lore.kernel.org/r/77868edb7aff9d5cb12ac3af8827ef2e244441a6.1567150471.git.baolin.wang@linaro.org Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/sprd-dma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index baac476c86224..525dc7338fe3b 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -908,6 +908,7 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, struct sprd_dma_chn *schan = to_sprd_dma_chan(chan); struct dma_slave_config *slave_cfg = &schan->slave_cfg; dma_addr_t src = 0, dst = 0; + dma_addr_t start_src = 0, start_dst = 0; struct sprd_dma_desc *sdesc; struct scatterlist *sg; u32 len = 0; @@ -954,6 +955,11 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, dst = sg_dma_address(sg); } + if (!i) { + start_src = src; + start_dst = dst; + } + /* * The link-list mode needs at least 2 link-list * configurations. If there is only one sg, it doesn't @@ -970,8 +976,8 @@ sprd_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, } } - ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len, - dir, flags, slave_cfg); + ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, start_src, + start_dst, len, dir, flags, slave_cfg); if (ret) { kfree(sdesc); return NULL;