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=-5.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 EF595C4361B for ; Mon, 7 Dec 2020 15:05:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA3F62370D for ; Mon, 7 Dec 2020 15:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbgLGPF2 (ORCPT ); Mon, 7 Dec 2020 10:05:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbgLGPF1 (ORCPT ); Mon, 7 Dec 2020 10:05:27 -0500 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25F34C061793 for ; Mon, 7 Dec 2020 07:04:41 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id p187so13629595iod.4 for ; Mon, 07 Dec 2020 07:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wZXGgbnZ8cr/0Rdgsg8K6lYkELQtNZTW++ELghaI2sA=; b=nFRzR+gbLLYeXQW0Ah+9hwRhhbtRxhRC1Z+B71h5O3N88OlwY/9DsiwpvsO8u1hsPL UjeyktuhRCxR/CytnMiDmBtDLpzFKfdl74vr/XBK2GIIGUuXwYla/uUQLniWlySGZOMg UN8CuOVwThl2MUypIH9Dok/GCcwnymSYi4Jsa2xIDrkGFk050WVX79nIkvFckZu3eBX9 LZM8F3ModQEeS5FT6Yex7JJI4P4qDjPkAZXvUj022+CZG4LB0YUjBqgUsE4t5vGxJIZx d//d70FjqUa7hKcmNcqQNljnzHkaM9IK+vYrf+TnqeNnn+HG4P3WFgUN2NHodcSHC9AI HkXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wZXGgbnZ8cr/0Rdgsg8K6lYkELQtNZTW++ELghaI2sA=; b=Q9+18kXkhCZ7CYlVUAXHEIFDuOmgYV4ADj8zHTAluwi8hmMw1XMDRjoz91rWK9PAyV XKCbOtPYZgyAbyAyD0KzbU/+7bNfyk/hL5AJ1aLw30LnGj7Pt8lSQ3Ki/tbr/2wxnppE 0yDrmDDbkGyYuGwYY2vvGsp9JqpIeDO19mWf9h8nVzodb0Pbln9faHxwXLuI540akBH7 k8BtBcqSjoTci4Fh9qBscCHK5Jy8yysq0GdjkMJ7y14dEQO9nQRYURV3dYFr2yHtlTEG pcNbylHn6i7Tl9fSC/lJgzgfz1DQsjMmKFjBJhMK59BAS448ZLBv/ql/UW3h8GXdwerH B6Ng== X-Gm-Message-State: AOAM533jtiBLgh+boAB6U2r/FPv+mB9vn8ozJgCiVAxaSr2fwkBEshvV jGBQn7CoQ7Pc++L4lpW0Nhr4Ug== X-Google-Smtp-Source: ABdhPJwVc+ApxMZ5Dz5ik7ifV1t7aLoJlEZO+JWLeP7ZNiFTeQZzBCNHB5hhoKQCGQqL0ZpZ+Ul15Q== X-Received: by 2002:a5e:8344:: with SMTP id y4mr20562092iom.116.1607353480454; Mon, 07 Dec 2020 07:04:40 -0800 (PST) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id c2sm7562579iln.70.2020.12.07.07.04.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Dec 2020 07:04:39 -0800 (PST) Subject: Re: [PATCH] io_uring: fix file leak on creating io ctx To: Hillf Danton , LKML Cc: io-uring@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+71c4697e27c99fddcf17@syzkaller.appspotmail.com, Pavel Begunkov References: <20201207081558.2361-1-hdanton@sina.com> From: Jens Axboe Message-ID: <13bd991a-be45-6521-655d-74b8d810b714@kernel.dk> Date: Mon, 7 Dec 2020 08:04:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201207081558.2361-1-hdanton@sina.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/7/20 1:15 AM, Hillf Danton wrote: > Put file as part of error handling when setting up io ctx to fix > memory leak like the following one. > > BUG: memory leak > unreferenced object 0xffff888101ea2200 (size 256): > comm "syz-executor355", pid 8470, jiffies 4294953658 (age 32.400s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > 20 59 03 01 81 88 ff ff 80 87 a8 10 81 88 ff ff Y.............. > backtrace: > [<000000002e0a7c5f>] kmem_cache_zalloc include/linux/slab.h:654 [inline] > [<000000002e0a7c5f>] __alloc_file+0x1f/0x130 fs/file_table.c:101 > [<000000001a55b73a>] alloc_empty_file+0x69/0x120 fs/file_table.c:151 > [<00000000fb22349e>] alloc_file+0x33/0x1b0 fs/file_table.c:193 > [<000000006e1465bb>] alloc_file_pseudo+0xb2/0x140 fs/file_table.c:233 > [<000000007118092a>] anon_inode_getfile fs/anon_inodes.c:91 [inline] > [<000000007118092a>] anon_inode_getfile+0xaa/0x120 fs/anon_inodes.c:74 > [<000000002ae99012>] io_uring_get_fd fs/io_uring.c:9198 [inline] > [<000000002ae99012>] io_uring_create fs/io_uring.c:9377 [inline] > [<000000002ae99012>] io_uring_setup+0x1125/0x1630 fs/io_uring.c:9411 > [<000000008280baad>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > [<00000000685d8cf0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Applied for 5.10, thanks. -- Jens Axboe