Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1116187rwd; Wed, 7 Jun 2023 11:11:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6+deSaM9mwXigEp3Jb1XgmsLB1yilvuHnskFVjMs8lRHL7FtsHv0vqtydM6ItlhDYiYiz0 X-Received: by 2002:a05:6a20:441a:b0:100:3964:6cb with SMTP id ce26-20020a056a20441a00b00100396406cbmr4117338pzb.40.1686161475787; Wed, 07 Jun 2023 11:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686161475; cv=none; d=google.com; s=arc-20160816; b=GL5QxFqccgzfwDL0xpt96AtkeqmDSSgc375yLbMIoOQamrps2TJ7b0RnN/F5+Kp14X qW06XIkIfc7AQ5lLJhzUFWremufCdWwFEZsHLkuJGo7qF5vr7yyJ5SdhGOWnGpxCZw2z ZNUz9Oe71eRkcIyWHHD6HvGumjA6Um8DGdmla0uuvPqoR7gRwjleosvv6QrG44qpa1mP nJphN/L+sDbPGg2dgKrJj8PPr1fEFX2bI6O5Xze7XQtr9CVK6NJEJ2X4j3zjHaiumaKV bdzLZSBzPwxvuHqD979rMfs0yVOax2JXKLQOk+/oukitYnzPNDZUVAbF5jb1Zre2H9qV 04tw== 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=rSFLDeg//MATy4wRPYzPvpAlJi/Om/Q2dfHBbonUMYg=; b=fOAfCGZsL6NV7TYbisTFBChEBVJ0MDvb9qA1hb2WUAoUNqVwDkUn+b+/lK1+YdqdAe 0hSSXTIhri9RzWuw7VbUenWXHrlgPE81NgyNNkWNYX1mZJCwgnxHxZCfnhRGB0xHG4uk 7Xr7f91Ynl0ENNmqCDmOO0Df1OnFdB14z+Yy8t0LaAU57siz5FBi9UKNnltOcbE2TceM F+dgxzhvlIUjrrFWwxoaRWX0zyXnhY91QIi9UoY4BhtDrqQkSL9KHvVLRtfB5arM+v+B fJ0HIzi9GlWJ/gqapJPf2mJ72bThbirzrTyJvbVKRnceTZMcnkTrASmymaDhRhqV+b+R xauA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=REuygNSS; 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 l3-20020a17090a850300b0025998ebdc4csi1404893pjn.60.2023.06.07.11.10.40; Wed, 07 Jun 2023 11:11:15 -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=REuygNSS; 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 S230496AbjFGR27 (ORCPT + 99 others); Wed, 7 Jun 2023 13:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjFGR24 (ORCPT ); Wed, 7 Jun 2023 13:28:56 -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 E7F1A128; Wed, 7 Jun 2023 10:28:54 -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=1686158932; bh=vGUG5+5oObmVUMabCNgsKcKkHQm2lWjGYzZ1M+89FSk=; h=From:Date:Subject:To:Cc:From; b=REuygNSSwrT5jIxKvsN28vuZ/cs8XfMn+12DSgMfY5RxhC+sWXCL9vc0tEytMCjQb 05pt0RsH6dJanwO3393YuAXrE1zqO2ney6umLmXj3kDGfwVqlFC/RHjg0RNyCrbwdU eHtFD9DbByXTIhE8zIJxwvMM0Z0LZFEu3kmHU+5c= Date: Wed, 07 Jun 2023 19:28:48 +0200 Subject: [PATCH] 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-v1-1-20c8dbf4671b@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAE++gGQC/x2N0QqDMAxFf0XybKBGVmG/MnxoNc6Aq6VR2RD/3 bDHczmHe4JyEVZ4VicUPkRlTQZNXcEwh/RmlNEYyFHrvOtwUuRP3n645s1cJP/wRG3XmABWxaC MsYQ0zNalfVlszIUn+f5vXv113XtkcZx2AAAA 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=1686158931; l=1248; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=vGUG5+5oObmVUMabCNgsKcKkHQm2lWjGYzZ1M+89FSk=; b=xhti7ZhwZRPSH3Hgfw1or7/06qz18rCyqWGpAlyNjvbuso7uaeCsOL0oGQ/kvzetFYV78p9r5 vOP30ikcCPeC3hE7I9eZEjC4UjhTsX05D9hBZJk67VLhQwwASbWhNsn 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") Signed-off-by: Thomas Weißschuh --- 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