Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1703419rwb; Thu, 29 Sep 2022 00:37:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IL7qgaWSdqEdJYn6fOQnrTuon1UX21jqUcBGIgwXLp/6dCCUMeLxShzGO0ibrt2+e1kuU X-Received: by 2002:aa7:cc86:0:b0:457:f801:2951 with SMTP id p6-20020aa7cc86000000b00457f8012951mr1975230edt.16.1664437069988; Thu, 29 Sep 2022 00:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664437069; cv=none; d=google.com; s=arc-20160816; b=zRuM0fyOySrOTZ476P2l9gfOGIWV7xPv/r+f8cEERijVPA6Oi+U0XCCOYUcSH8W5Qn /wPk5mUI19ImekV7JFoDVnmYfxukgs7hiuyJ8NlDvk2zZGMlMVqwV3BLtcpzgux4Xi0q KxRe3X30yj1U+gyHnnbj1Cr6RXSmTl0HzK3NWpSfHwhpL4gPbeP+mkOJ6IQ8fpZ3TcUt d1p4nfDRFtohAks4Jwayt6H35DvSVeVfev9v+HiJW9kt72kuADHFiIdhBOTSpTU2Khoc TAFLCODlH26ECXsbWvWDnxTsgcrT8DsJjls4u2Ojm9ixRhEsIapbNxQYAW3cNyAUae4f xfjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=8xgJCeoUgsZNjtT6KDoCDIr+mxANEC08PbBvO5haN7Q=; b=LfJNqWLBr5BFVxhhHpaE3qiGFW/0ofzA7R8LfvFUkO3ZAx0cNVBU3NcPoZf0ijDB7f KpA7qFSrOK8jZsjAMV6CWjwEG8XN9Jtxl03G2ZRHIYR3ufQZ9U4Zi5fkOAfgQl2Lemlh v2yGw807Rm0t1D9FF/nLDVcc9LJEdMqOPwuBFLlExfggledsCDjzEGvaVp1WGNIGwznJ dP8qIqQ5VfqKuJyHabzRReClbzTkemh8IM4NmtwIzKi183bcv0iS9nxUlmutkOJ+/WP5 XYOa9oqnGe427nw/iGiPxtI/Oqd+bAQsKV9n4XGWXEB70oDmrGz1hZzRGXW9tcZBQTHu Cotg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=KZaQ3bR2; dkim=pass header.i=@codewreck.org header.s=2 header.b=KZaQ3bR2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn19-20020a1709070d1300b0078786e168fcsi5384278ejc.452.2022.09.29.00.37.23; Thu, 29 Sep 2022 00:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=KZaQ3bR2; dkim=pass header.i=@codewreck.org header.s=2 header.b=KZaQ3bR2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235299AbiI2HZX (ORCPT + 99 others); Thu, 29 Sep 2022 03:25:23 -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== X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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