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 33001C6FA82 for ; Thu, 22 Sep 2022 09:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbiIVJi2 (ORCPT ); Thu, 22 Sep 2022 05:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbiIVJi1 (ORCPT ); Thu, 22 Sep 2022 05:38:27 -0400 Received: from kylie.crudebyte.com (kylie.crudebyte.com [5.189.157.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C99D4336 for ; Thu, 22 Sep 2022 02:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=kylie; h=Content-Type:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Content-ID:Content-Description; bh=7/tUR8Twi9O5B7cIIo+vV2uW+fGk3+Mw/gvhBQ3/U1U=; b=EsvNZA9CO8vydLl2jUH5NHjWrr suqd1xw9apHI4ciQQP2ynoNZ2I4idoh5HZaimNJl8FKyahAxF/ygbnvSF/zT8Kf+G2ilPEQrttgU5 yp5zJccKZPyE1YnJruD+rzre2qZ1+V0yVhvltViUuFhiB28Lk0/Xz6fg01+BVbcdNYHZD7kfDvlhH GDh1Nmadcd/cImJRmHEcHi+POa917fEDCN8aoDWZrf4Z5IRKFGUiyVYJkD1i2ipgjg+QUoh4tpoCI uXTlr3GSkslRSENtkLOCbWs+AFBeuxPq+mNYx7wtZ9oPcYwj09HG+XWGR7la5QfM92ZuQexwYAavA f+jh4WfzfxD3tKx+ZPfCFICQY9bJrbuXBFi7PI1cwepn4c75y+tFcegGP66PP1SuAY5tcvto4/TPf YBJ3aoPbOBfLHL+ynZzvmGRyhTml6MX+wHQlDambWjjaIhc9R2HmKmM0PLjuwJB3hd2GhwF+ingcC kptTD3hfIYvg+tInzqZwRAN5oHnlTro5bHWrId80tbYtUtj/MzTe2k0WbFx5Qlss7CHlQ+hRdATdV u9LFsXUYCnkbDnR8+y2AzkRsRlnH0G+ZziLRAfS5Fe8hU6DTAjXvOq+QFxL4gg7piyU5yhpLFEj8O yjhAa/SvOy6LlP7SSZwwTwR1E6vod51WdXouPhtEU=; From: Christian Schoenebeck To: asmadeus@codewreck.org, Li Zhong Cc: netdev@vger.kernel.org, v9fs-developer@lists.sourceforge.net, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, lucho@ionkov.net, ericvh@gmail.com Subject: Re: [PATCH net-next v1] net/9p/trans_fd: check the return value of parse_opts Date: Thu, 22 Sep 2022 11:38:20 +0200 Message-ID: <2328558.MEb0jBPE05@silver> In-Reply-To: References: <20220921210921.1654735-1-floridsleeves@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Donnerstag, 22. September 2022 00:12:38 CEST Li Zhong wrote: > On Wed, Sep 21, 2022 at 2:23 PM wrote: > > Li Zhong wrote on Wed, Sep 21, 2022 at 02:09:21PM -0700: > > > parse_opts() could fail when there is error parsing mount options into > > > p9_fd_opts structure due to allocation failure. In that case opts will > > > contain invalid data. > > > > In practice opts->rfd/wfd is set to ~0 before the failure modes so they > > will contain exactly what we want them to contain: something that'll > > fail the check below. > > > > It is however cleared like this so I'll queue this patch in 9p tree when > > I have a moment, but I'll clarify the commit message to say this is > > NO-OP : please feel free to send a v2 if you want to put your own words > > in there; otherwise it'll be something like below: > > ---- > > net/9p: clarify trans_fd parse_opt failure handling > > > > This parse_opts will set invalid opts.rfd/wfd in case of failure which > > we already check, but it is not clear for readers that parse_opts error > > are handled in p9_fd_create: clarify this by explicitly checking the > > return value. > > ---- > > Thanks for the patient reply! I agree that the check on > opts.rfd/wft against ~0 will prevent error even if it fails > memory allocation. But currently the error log is > 'insufficient options', which is kind of misleading and the > error code returned is -ENOPROTOOPT instead of -ENOMEM, which > I guess would be better if we distinguish between them. Avoiding those confusions for users makes sense to me, but then please also mention that in the commit log, because it is also useful to know the actual motivation of a patch. Best regards, Christian Schoenebeck