From patchwork Mon Apr 26 07:29:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 427810 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, URIBL_RED, 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 9FF9FC43619 for ; Mon, 26 Apr 2021 07:45:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 79FBC60FEE for ; Mon, 26 Apr 2021 07:45:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233281AbhDZHpx (ORCPT ); Mon, 26 Apr 2021 03:45:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:33434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233998AbhDZHok (ORCPT ); Mon, 26 Apr 2021 03:44:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6B7B611C1; Mon, 26 Apr 2021 07:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619422869; bh=vJoycszaeIqNNiuqQYU/Ee9eUtjvNQbOEef7Um3ihps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kMjd5qZQlFcrlp23APZ/T2aAciB2kwBD56Fsz+Lvw9TxFeU4lbd0hyYS9Ukq8/P3z ezq8VAt5DfgoTjig4KHClJ22LY2JHrjtt9p5aeG9fRMYWkdy8j6BZDmMH6HOM/kEJn akX/b7SDVZFAr9BXi53RZJL8/ifsxy7u7ovQmrFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , Jan Harkes , Miklos Szeredi , Jason Gunthorpe , Andrew Morton , Linus Torvalds Subject: [PATCH 5.11 03/41] coda: fix reference counting in coda_file_mmap error path Date: Mon, 26 Apr 2021 09:29:50 +0200 Message-Id: <20210426072819.798152252@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210426072819.666570770@linuxfoundation.org> References: <20210426072819.666570770@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian König commit 9da29c7f77cd04e5c9150e30f047521b6f20a918 upstream. mmap_region() now calls fput() on the vma->vm_file. So we need to drop the extra reference on the coda file instead of the host file. Link: https://lkml.kernel.org/r/20210421132012.82354-1-christian.koenig@amd.com Fixes: 1527f926fd04 ("mm: mmap: fix fput in error path v2") Signed-off-by: Christian König Reviewed-by: Daniel Vetter Acked-by: Jan Harkes Cc: Miklos Szeredi Cc: Jason Gunthorpe Cc: [5.11+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/coda/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -175,10 +175,10 @@ coda_file_mmap(struct file *coda_file, s ret = call_mmap(vma->vm_file, vma); if (ret) { - /* if call_mmap fails, our caller will put coda_file so we - * should drop the reference to the host_file that we got. + /* if call_mmap fails, our caller will put host_file so we + * should drop the reference to the coda_file that we got. */ - fput(host_file); + fput(coda_file); kfree(cvm_ops); } else { /* here we add redirects for the open/close vm_operations */