Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1952106imb; Sun, 3 Mar 2019 12:14:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwZ1FcaOB2P8UQHQXSQ2vGGtaHo3olpRiO79lUP0dVtcA0ToBoXlY/UdVKu7cTm7v8Go5NR X-Received: by 2002:a17:902:3143:: with SMTP id w61mr17122287plb.253.1551644070674; Sun, 03 Mar 2019 12:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551644070; cv=none; d=google.com; s=arc-20160816; b=R17dVQYkMxgkIgAmkNj4pJIKl99GvSyv/8IL5mXVPvYIhoZotPP3tqlgUfrXc3TZcb BHCA685dkQa54JH8Ifm08CibfHYe1eswMmhOZ6ml0/nNrSylXjAzlEB50MvV/ervW1Xz QDF8R4aarhaOAtlaEUgt9Uzm9bFCBCshAsrZoWXnABLtaSaKue+y1P+bRmDbWanuTQe2 WAEMVuizEsH2Bwebv8i4MQyLtxfFtysS7iG7srxBButSYyJo5Xlg977iEbQe9O1lJfIE rI71duwTgj7O1R+mAh7aznSUJlHI10xnFUiB1xJYO10VIrYF5RO/OD7Vj6OvowRH9M0x dYCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=x1iMEQoPgXk1WJSYeb2Z3XqmYDbk/Fcp2JImzIRwCU0=; b=TT/lMqZ74wpT6q7sxgd+YFBBNPfq03R81oW4gJEyPC+KEldqxoE3QRc2UnReXCiO/R sHmROKeiOwigeEo3NxMOCKVM1BnMeq/ZLFdbK+I/vUyQoGG5yAf11T45gW+a2cwRtBQ4 Wtm3DFgdM5IuAUx0p1QtR4oSdlb6E2jEVz4CLgrrEkQ+gQlEL+/9aGKmiEtH/LEEmxGJ 6Qtq2dzghOsfrKD7XLpqDrtA+GBuQxx8Gk87EhxGOg2TnffE6mya4+qwdXRWOM5xUHgB gSNpe/uz3hKLCPW25oRF332Lfamuhz+umqN4TJlF5ABBbDtFajYylLpRAJgFp/dusR8M q5Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="e7/nVcpD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v63si3505755pgd.563.2019.03.03.12.14.14; Sun, 03 Mar 2019 12:14:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="e7/nVcpD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbfCCUNx (ORCPT + 99 others); Sun, 3 Mar 2019 15:13:53 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:46568 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbfCCUNx (ORCPT ); Sun, 3 Mar 2019 15:13:53 -0500 Received: by mail-lj1-f194.google.com with SMTP id v16so2456909ljg.13 for ; Sun, 03 Mar 2019 12:13:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=x1iMEQoPgXk1WJSYeb2Z3XqmYDbk/Fcp2JImzIRwCU0=; b=e7/nVcpDoI+4NGiOf6LPzCJB5Ze7AbKuNZtJnKQEzPgLhf6oPrhDF3Tn+yYSZe0LMe +g2CVcs9oK7MyTPL0HwQawhGLi6lHMvKH1+81RQxKAJuyByy3/hEqw4nm7pxJYdXFUMd JdLaF2VbwOfr5PCvA8gEYXG62JzPN/RsRgx7c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=x1iMEQoPgXk1WJSYeb2Z3XqmYDbk/Fcp2JImzIRwCU0=; b=BQgT8XF6ET2sbRVvjFqvsJmTzBDY+zsvF1CWOVl2ndy32UqIhYbUBpaE+mAUv9Zvof zOieN/6r25rFGMml/EofABLx39b5cKAY/lohCh9+/NT7ThD/ElxdrYzdna23G2kMeL3V VAk0EvdnNain09p1H7gA2NjaUviHn2/uWbtF8wra66WM3hcjOYy4oIr9MTkIQueuf+EK 9xXsQQMkfgbserDBaVcpVRc7lUmjczUt2grkA7QUvV+Tqaxc0qyP/M4Ommh2+hp27uFK oTb7idkUGfxWEN/RgjubeFoRCI1logMYYBaFWDimHSRiJ4PPzuoy2DIxT6GyfG/rORQD aUlg== X-Gm-Message-State: APjAAAV9GZoDZU0oPndqkTO/lD4+YOwVwR2asQ89JoaFPDi9RyxK2YWt EDtmIWjIBj9h4Z69eb6am5t6dN7HQZ8= X-Received: by 2002:a2e:880a:: with SMTP id x10mr8580629ljh.12.1551644030734; Sun, 03 Mar 2019 12:13:50 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id x2sm1130845ljd.30.2019.03.03.12.13.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Mar 2019 12:13:49 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id g80so2471868ljg.6 for ; Sun, 03 Mar 2019 12:13:49 -0800 (PST) X-Received: by 2002:a2e:7a03:: with SMTP id v3mr8852138ljc.22.1551644029066; Sun, 03 Mar 2019 12:13:49 -0800 (PST) MIME-Version: 1.0 References: <000000000000f39c7b05832e0219@google.com> <20190303135502.GP2217@ZenIV.linux.org.uk> <20190303151846.GQ2217@ZenIV.linux.org.uk> In-Reply-To: From: Linus Torvalds Date: Sun, 3 Mar 2019 12:13:33 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] aio: prevent the final fput() in the middle of vfs_poll() (Re: KASAN: use-after-free Read in unix_dgram_poll) To: Al Viro , Eric Dumazet Cc: David Miller , Jason Baron , kgraul@linux.ibm.com, ktkhai@virtuozzo.com, kyeongdon.kim@lge.com, Linux List Kernel Mailing , Netdev , pabeni@redhat.com, syzkaller-bugs@googlegroups.com, xiyou.wangcong@gmail.com, Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 3, 2019 at 11:44 AM Linus Torvalds wrote: > > But doesn't it look nice to see > > 2 files changed, 41 insertions(+), 50 deletions(-) > > with actual code reduction, and a fundamental simplification in > handling of the file pointer? A coupl,e of the changes are "useless", and do the same thing as not having them at all: - struct inode *inode = file_inode(kiocb->ki_filp); + struct inode *inode = file_inode(iocb->ki_filp); - file_end_write(kiocb->ki_filp); + file_end_write(iocb->ki_filp); because the "ki_filp" ends up existing in both kiocb and iocb. At one point of editing that file I decided to try to just remove it from the sub-structs entirely and only keep it in the top-level structure, but it needs to be inside the 'struct kiocb' anyway for all the other users outside of fs/aio.c. Anyway, I don't think the patch is wrong (although I haven't actually _tested_ it) but I wanted to point out that those two one-liner changes are just "noise" that doesn't matter for the working of the patch. In the above, we have 'kiocb' being the embedded 'struct kiocb', and 'iocb' is the 'struct aio_kiocb' that contains it. 'ki_filp' is the exact same field in both cases. Linus Linus