From mboxrd@z Thu Jan 1 00:00:00 1970 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=unavailable 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 2338BC433E0 for ; Tue, 23 Jun 2020 21:01:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1C4C2070E for ; Tue, 23 Jun 2020 21:01:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592946095; bh=0ucHMYDFft9f8l+yGC+JoPvteAuq9Z9BYn60Xkfsr+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SUtS0BY7oAL59XEz1BjybX6QwSQfKTzjbxTY1Ex0s/tENri66rlM/bt1ybp8WbUHT 9a7fuci/PuIjnxC0BhE4mbDq0hnUKXDLEG1C62/eYHl3ti6GNWRB9lHy7FFk6sVK7t xBAIU8bHciKqN8r7wadHE9nwXR6MMEkG6TR5oFfE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392113AbgFWUjv (ORCPT ); Tue, 23 Jun 2020 16:39:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:35500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392085AbgFWUjo (ORCPT ); Tue, 23 Jun 2020 16:39:44 -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 2B12B217D8; Tue, 23 Jun 2020 20:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592944783; bh=0ucHMYDFft9f8l+yGC+JoPvteAuq9Z9BYn60Xkfsr+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsyXPi1+Etho+8HgzjAcUvwUzoCveOQTIIr2xecRviHzJunqDjqf1LQXtqTUYnmLO Litnq+cI/0yFWzt1Igj11dmSv3pL4bnZ6sgMuefYHK2vYX2fZlqea2TybtVpz3+XzV C1deHRK8/G81RnxJgSc6O3KqPwfbgV6HJ7G2zhbU= 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 4.19 096/206] fpga: dfl: afu: Corrected error handling levels Date: Tue, 23 Jun 2020 21:57:04 +0200 Message-Id: <20200623195321.662025579@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195316.864547658@linuxfoundation.org> References: <20200623195316.864547658@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 c9a613dc9eb7e..e056965ef97b3 100644 --- a/drivers/fpga/dfl-afu-dma-region.c +++ b/drivers/fpga/dfl-afu-dma-region.c @@ -106,10 +106,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); -- 2.25.1