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=-11.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,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 0D590C43603 for ; Wed, 11 Dec 2019 15:07:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3EB6208C3 for ; Wed, 11 Dec 2019 15:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076875; bh=LxkpKmY76okQTg+AgmMzvZzLQNdZsYbEck/TtAYcZOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P4qe/q7wRl1Ljo8Wbv+yWRWTgB6d3y4MZPEcZQhs09NTQOVWp1x60upYRf8qbUQMf Uh2ZcfA+vuCI919T0bbyOTwCX+ZL0lSP9YdO2mBzFnN1QgCwXhhLvYlZ9bxp4XwSde ANKEJoyG3hHUw/0sitSfIM84oaqkyB1668R8iE38= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730172AbfLKPHy (ORCPT ); Wed, 11 Dec 2019 10:07:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:55162 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730156AbfLKPHw (ORCPT ); Wed, 11 Dec 2019 10:07:52 -0500 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 5E0BA208C3; Wed, 11 Dec 2019 15:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576076871; bh=LxkpKmY76okQTg+AgmMzvZzLQNdZsYbEck/TtAYcZOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3aAtibd2VH3zkAalj7aiK3skjLtsJ1rJxJ6xQxytd5yuXNfLM/pO8MO8KipUMlrM GUKbq9y3FIlbkMbxJ3BqXg1JPzUD6/P1jqZnl7ke2OY8pzu0X107HdPSF/TiBpBA/e dwl3j7Zp8wav9d5aBJ38yHzHoROqQM3ekd7UPU0k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masayoshi Mizuma , Miklos Szeredi Subject: [PATCH 5.4 22/92] fuse: fix leak of fuse_io_priv Date: Wed, 11 Dec 2019 16:05:13 +0100 Message-Id: <20191211150229.026735059@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150221.977775294@linuxfoundation.org> References: <20191211150221.977775294@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: Miklos Szeredi commit f1ebdeffc6f325e30e0ddb9f7a70f1370fa4b851 upstream. exit_aio() is sometimes stuck in wait_for_completion() after aio is issued with direct IO and the task receives a signal. The reason is failure to call ->ki_complete() due to a leaked reference to fuse_io_priv. This happens in fuse_async_req_send() if fuse_simple_background() returns an error (e.g. -EINTR). In this case the error value is propagated via io->err, so return success to not confuse callers. This issue is tracked as a virtio-fs issue: https://gitlab.com/virtio-fs/qemu/issues/14 Reported-by: Masayoshi Mizuma Fixes: 45ac96ed7c36 ("fuse: convert direct_io to simple api") Cc: # v5.4 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -713,8 +713,10 @@ static ssize_t fuse_async_req_send(struc ia->ap.args.end = fuse_aio_complete_req; err = fuse_simple_background(fc, &ia->ap.args, GFP_KERNEL); + if (err) + fuse_aio_complete_req(fc, &ia->ap.args, err); - return err ?: num_bytes; + return num_bytes; } static ssize_t fuse_send_read(struct fuse_io_args *ia, loff_t pos, size_t count,