From patchwork Tue Jun 23 19:53:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4322CC433DF for ; Tue, 23 Jun 2020 20:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 234EC2073E for ; Tue, 23 Jun 2020 20:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943142; bh=c3D9IJ41MsusLeTMRh0YH9A/48jMQYCr5ECatNOuTpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BrMx1vxNJ8lyeuAT4SpLpPbDw41yDQcTmlJxlrhdzOl4ziP5Ck1O0wQcX2jRrL1lY GTpGUjEnrb9jSn30KyMY+vLb3nsnS5FoLlggQFBod0Ri+fEwWPTYPTvs5FGkJrsuRk +Q4hQMWMa9EeP7RHcxMdGZsoiogZ074gIkhq5LB4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388962AbgFWUMU (ORCPT ); Tue, 23 Jun 2020 16:12:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:53894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388958AbgFWUMT (ORCPT ); Tue, 23 Jun 2020 16:12:19 -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 4596420707; Tue, 23 Jun 2020 20:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943138; bh=c3D9IJ41MsusLeTMRh0YH9A/48jMQYCr5ECatNOuTpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=usDmFIWMZxfpkSvMwM0gSOP6VQ9GvfZN4vnfQGL8k8VoWiaEydqCzoh82CkT6dkkw zRIkNjuXhVO+Of93B001rTdNNznbGQi6rWzquoeNB0tYvU18KvYicM503I6vLUDEmt P29FKMiqn4D/8lKR9bNTl9USZMLqxcU9p8PwkCbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Souptick Joarder , Wu Hao , Xu Yilun , Sasha Levin Subject: [PATCH 5.7 234/477] fpga: dfl: afu: Corrected error handling levels Date: Tue, 23 Jun 2020 21:53:51 +0200 Message-Id: <20200623195418.634165969@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195407.572062007@linuxfoundation.org> References: <20200623195407.572062007@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: Souptick Joarder [ Upstream commit c9d7e3da1f3c4cf5dddfc5d7ce4d76d013aba1cc ] Corrected error handling goto sequnece. Level put_pages should be called when pinned pages >= 0 && pinned != npages. Level free_pages should be called when pinned pages < 0. Fixes: fa8dda1edef9 ("fpga: dfl: afu: add DFL_FPGA_PORT_DMA_MAP/UNMAP ioctls support") Signed-off-by: Souptick Joarder Acked-by: Wu Hao Reviewed-by: Xu Yilun Link: https://lore.kernel.org/r/1589825991-3545-1-git-send-email-jrdr.linux@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/fpga/dfl-afu-dma-region.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c index 62f924489db59..5942343a5d6ea 100644 --- a/drivers/fpga/dfl-afu-dma-region.c +++ b/drivers/fpga/dfl-afu-dma-region.c @@ -61,10 +61,10 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, region->pages); if (pinned < 0) { ret = pinned; - goto put_pages; + goto free_pages; } else if (pinned != npages) { ret = -EFAULT; - goto free_pages; + goto put_pages; } dev_dbg(dev, "%d pages pinned\n", pinned);