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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 433AEC43461 for ; Tue, 6 Apr 2021 14:15:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EE9B613A7 for ; Tue, 6 Apr 2021 14:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344968AbhDFOPO (ORCPT ); Tue, 6 Apr 2021 10:15:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244364AbhDFOPN (ORCPT ); Tue, 6 Apr 2021 10:15:13 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 609F8C06174A; Tue, 6 Apr 2021 07:15:05 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lTmTt-0037iV-Fc; Tue, 06 Apr 2021 14:15:01 +0000 Date: Tue, 6 Apr 2021 14:15:01 +0000 From: Al Viro To: Christian Brauner Cc: Jens Axboe , syzbot , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, io-uring@vger.kernel.org Subject: Re: [syzbot] WARNING in mntput_no_expire (2) Message-ID: References: <20210405114437.hjcojekyp5zt6huu@wittgenstein> <20210405170801.zrdhnon6g4ggb6c7@wittgenstein> <20210405200737.qurhkqitoxweousx@wittgenstein> <20210406123505.auxqtquoys6xg6yf@wittgenstein> <20210406132205.qnherkzif64xmgxg@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210406132205.qnherkzif64xmgxg@wittgenstein> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 06, 2021 at 03:22:05PM +0200, Christian Brauner wrote: > Why is a another function in charge of checking the return value of an > initialization function. If something like path_init() fails why is the > next caller responsible for rejecting it's return value and then we're > passing that failure value through the whole function with if (!err) > ladders but as I said it's mostly style preferences. Because otherwise you either need *all* paths leading to link_path_walk() duplicate the logics (and get hurt whenever you miss one) or have "well, in some cases link_path_walk() handles ERR_PTR() given to it, in some cases its caller do" mess. > > > s = path_init(nd, flags); > > > - if (IS_ERR(s)) > > > - return PTR_ERR(s); > > > > Where has that come from, BTW? Currently path_lookupat() does no such thing. > > Hm? Are you maybe overlooking path_init() which assigns straight into > the variable declaration? Or are you referring to sm else? I'm referring to the fact that your diff is with an already modified path_lookupat() _and_ those modifications have managed to introduce a bug your patch reverts. No terminate_walk() paired with that path_init() failure, i.e. path_init() is responsible for cleanups on its (many) failure exits...