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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3299BC04A95 for ; Thu, 29 Sep 2022 07:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235005AbiI2HZY (ORCPT ); Thu, 29 Sep 2022 03:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235218AbiI2HYx (ORCPT ); Thu, 29 Sep 2022 03:24:53 -0400 Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD442E2 for ; Thu, 29 Sep 2022 00:24:32 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 108) id B0109C01D; Thu, 29 Sep 2022 09:24:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1664436269; bh=8xgJCeoUgsZNjtT6KDoCDIr+mxANEC08PbBvO5haN7Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KZaQ3bR27CTZjB1QUn3jqwPzDUY4DP3R6wqI4bIr0DK8FD+lcOpPu3+3zwYFtQ3Qw 8eqXELKd1WZuZz3Dv14TDo6JeH3ydBy3Wkc480gor0TVJko3b5JNLCmm5C0Vo/IaXN jNE4oX+LgVwdi1lySRI3DTgzmAv5e1yean+g0snTIf7KVbNOxVa26HY5gY3sGCKZKI mmGWQc//GT4TcV2RG4qVMvooGaGgIrMVbT9s2LsBnfEYFoFnI9zCiEqc1378Hi5fgs Cb7fuSwvrhezXRg+8nsuyasl3qx//RgSvjz80vUyiIbMTusDuumEuUS8WNsboDbVxi kgR3idl569eVA== Received: from odin.codewreck.org (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 4CED2C009; Thu, 29 Sep 2022 09:24:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1664436269; bh=8xgJCeoUgsZNjtT6KDoCDIr+mxANEC08PbBvO5haN7Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KZaQ3bR27CTZjB1QUn3jqwPzDUY4DP3R6wqI4bIr0DK8FD+lcOpPu3+3zwYFtQ3Qw 8eqXELKd1WZuZz3Dv14TDo6JeH3ydBy3Wkc480gor0TVJko3b5JNLCmm5C0Vo/IaXN jNE4oX+LgVwdi1lySRI3DTgzmAv5e1yean+g0snTIf7KVbNOxVa26HY5gY3sGCKZKI mmGWQc//GT4TcV2RG4qVMvooGaGgIrMVbT9s2LsBnfEYFoFnI9zCiEqc1378Hi5fgs Cb7fuSwvrhezXRg+8nsuyasl3qx//RgSvjz80vUyiIbMTusDuumEuUS8WNsboDbVxi kgR3idl569eVA== Received: from localhost (odin.codewreck.org [local]) by odin.codewreck.org (OpenSMTPD) with ESMTPA id e36ba166; Thu, 29 Sep 2022 07:24:25 +0000 (UTC) Date: Thu, 29 Sep 2022 16:24:10 +0900 From: Dominique Martinet To: Leon Romanovsky Cc: v9fs-developer@lists.sourceforge.net, linux_oss@crudebyte.com, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+67d13108d855f451cafc@syzkaller.appspotmail.com Subject: Re: [PATCH v3] 9p: client_create/destroy: only call trans_mod->close after create Message-ID: References: <20220928215800.1749929-1-asmadeus@codewreck.org> <20220928221923.1751130-1-asmadeus@codewreck.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Leon Romanovsky wrote on Thu, Sep 29, 2022 at 08:54:10AM +0300: > > + // ensure clnt->trans is initialized to call close() on destroy > > + // if and only if create succeeded > > + if (err < 0) { > > + clnt->trans = ERR_PTR(err); > > goto out; > > + } > > + if (IS_ERR(clnt->trans)) > > + clnt->trans = NULL; > > > > if (clnt->msize > clnt->trans_mod->maxsize) { > > clnt->msize = clnt->trans_mod->maxsize; > > @@ -1036,7 +1043,7 @@ void p9_client_destroy(struct p9_client *clnt) > > > > p9_debug(P9_DEBUG_MUX, "clnt %p\n", clnt); > > > > - if (clnt->trans_mod) > > + if (clnt->trans_mod && !IS_ERR(clnt->trans)) > > It is completely no-go to rely on internal value inside of structure after > failure in ->create() callback. We're overriding the value after ->create(), in both cases that might pose problem (success without setting trans/failure); I can't see how that would possibly fail. But as you've seen in the other commit I am in no shape to write any decent code and consider the implications of what I'm changing in this untangled mess, so you know what: I'll just leave this broken. Please send me a patch if you care, I'm done here. -- Dominique