Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1086411rwd; Wed, 7 Jun 2023 10:46:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TshaYQd2Pk7jBnY7yBGApqefY/j3BEyZTXdYgcySOYtDIORsLbX8sMP4w7VoAgHsZj6TM X-Received: by 2002:aca:1908:0:b0:398:1c55:82bd with SMTP id l8-20020aca1908000000b003981c5582bdmr5893852oii.45.1686159979773; Wed, 07 Jun 2023 10:46:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686159979; cv=none; d=google.com; s=arc-20160816; b=h+kdxOzTdxVJvUJMRDwVsXhMkLBW9jBUNaesKjsHYRBmu9niLVZg+2KBq+dSB0TjnR CcnYGMs91yTEC+hX1GIGBOsHCnKWpgkxCvNWW4HhNdWu7zxkxJe0aaGFGhbuWscOZ60G ESzv8FUn34iR9yeczOpRLYU5o7lE47SY1I4C/I+RXziqWAnLEogkVk6s3yJySeJlxYOg w0aJr113PN/oiOkbE+0Dl5L3R4ByPMc2omG8kMmjzhq43QS6Dw6DC/DvAymvmwttsrtZ I+R18Q67e+Bm8hGE0xjACVCNgKsR9tatNGCCse0X0iBrYIA2tSCMGXy2W9j7jH2iwokX Q1Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=ELfptfhcJQ7dWLlH8rr4Wcwt780d7opzmbgjNNnCGmg=; b=FHl0XOHDANXoiav5qjkd4Pxagc76hSUv1qJHX12zm1gT3/ivo69O1ABk7ucFdf/G8J WA+FOu/SqPJYcqQPcDfKQFk1iHijV+dzzxyagXqAPZIdm7vtoCNX7XHCEXiH2PyclpQ3 07x4OiwP9X3wwtfu8/FxMEpvImn1+oVWvDwo+qRaRzbEpThCtMfkoh1C7FWtzkee0UyF GExgUF6p9zrx/wyjPvr7ZWez34QiLzCOe20aJnkhMxlZ4NApfp7TGfEfEIlI8jTk9pny CZJ57fNmURCbJZjVIk3dVEe4fp9OhPR5W1Ke/rExbIUJqGbHmnln07cT/VTyI8Se9Y6L 0k8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=mFHce8rx; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a17090a7a8500b0025672b33392si1348034pjf.185.2023.06.07.10.46.05; Wed, 07 Jun 2023 10:46:19 -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=@weissschuh.net header.s=mail header.b=mFHce8rx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbjFGRjV (ORCPT + 99 others); Wed, 7 Jun 2023 13:39:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229659AbjFGRjU (ORCPT ); Wed, 7 Jun 2023 13:39:20 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F7CF19BF; Wed, 7 Jun 2023 10:39:19 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1686159557; bh=5rDKXRphCm5hSfMg9E8EiHD7LdAzDPAqz+JpNaExDw4=; h=From:Date:Subject:To:Cc:From; b=mFHce8rx1V8uP6l1qFTVenfj+CTczcwBtCpvW70GtF4Af+paLIRNu2aqEWbSnQGGK DfkQ1jf4jrgfw4QegZ7L4ZV9r1Mzk04lSSG9tAAblwegNvFcknwLLeHuR6YH/WEQDi qzVNK6hLY9KrlHnjKpwZt9zqAPWfu3Sh5Jmj99Lc= Date: Wed, 07 Jun 2023 19:39:09 +0200 Subject: [PATCH v2] fs: avoid empty option when generating legacy mount string MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230607-fs-empty-option-v2-1-ffd0cba3bddb@weissschuh.net> X-B4-Tracking: v=1; b=H4sIALzAgGQC/3WNQQ6CMBBFr0K6dkxbtBhX3MOwoGWwTbCQTkEJ4 e6O7F2+n//yNkGYApK4F5tIuAQKY2TQp0I438YnQuiYhZa6lEZW0BPga8orjFPmL2hzNVqXleK DYMu2hGBTG51nL87DwOOUsA+fI/NomH2gPKb1qC7qt/4PLAoUaOlune0vplK2fmMgIudnf46YR bPv+xdCAgQ7yAAAAA== To: Alexander Viro , Christian Brauner Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, David Howells , Karel Zak , stable@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686159556; l=1435; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=5rDKXRphCm5hSfMg9E8EiHD7LdAzDPAqz+JpNaExDw4=; b=oUJfE7kshkS/8Wb6safwZYMONGGPt/Ujmta4e4tMx9loVGy9BsmaNub0Ov05930vOSSL3xSae xKlmNP8i6/2AUp3wEoyVOHZqA7Po6WyW1JsRyxMY+xRIxpfTOuGVzfO X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= 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, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As each option string fragment is always prepended with a comma it would happen that the whole string always starts with a comma. This could be interpreted by filesystem drivers as an empty option and may produce errors. For example the NTFS driver from ntfs.ko behaves like this and fails when mounted via the new API. Link: https://github.com/util-linux/util-linux/issues/2298 Fixes: 3e1aeb00e6d1 ("vfs: Implement a filesystem superblock creation/configuration context") Cc: stable@vger.kernel.org Signed-off-by: Thomas Weißschuh --- Changes in v2: - Mention Cc stable@ in sign-off area - Link to v1: https://lore.kernel.org/r/20230607-fs-empty-option-v1-1-20c8dbf4671b@weissschuh.net --- fs/fs_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/fs_context.c b/fs/fs_context.c index 24ce12f0db32..851214d1d013 100644 --- a/fs/fs_context.c +++ b/fs/fs_context.c @@ -561,7 +561,8 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param) return -ENOMEM; } - ctx->legacy_data[size++] = ','; + if (size) + ctx->legacy_data[size++] = ','; len = strlen(param->key); memcpy(ctx->legacy_data + size, param->key, len); size += len; --- base-commit: 9561de3a55bed6bdd44a12820ba81ec416e705a7 change-id: 20230607-fs-empty-option-265622371023 Best regards, -- Thomas Weißschuh