All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: bernd@bsbernd.com
Cc: fuse-devel@lists.linux.dev
Subject: Re: [PATCH 01/10] mount_service: move the command line check into arg_in_cmdline()
Date: Fri, 25 Sep 2026 14:40:36 -0700	[thread overview]
Message-ID: <20260925214036.GQ6253@frogsfrogsfrogs> (raw)
In-Reply-To: <20260925-mount-service-bound-open-v1-1-bbf1a84c7995@bsbernd.com>

On Fri, Sep 25, 2026 at 12:23:29AM +0200, Bernd Schubert via B4 Relay wrote:
> From: Bernd Schubert <bernd@bsbernd.com>
> 
> mount_service_handle_mountpoint_cmd() compared the mount point with
> each argument of fuservicemount3 in its own loop. The next patch makes
> the same check for OPEN requests, so the loop moves into
> arg_in_cmdline(). There is no change in behaviour.
> 
> Assisted-by: LLM
> Signed-off-by: Bernd Schubert <bernd@bsbernd.com>

This is a reasonable hoist so
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  util/mount_service.c | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/util/mount_service.c b/util/mount_service.c
> index 0b3266309a8a..7549e0b5024f 100644
> --- a/util/mount_service.c
> +++ b/util/mount_service.c
> @@ -758,6 +758,18 @@ static int prepare_bdev(const struct mount_service *mo,
>  	return 0;
>  }
>  
> +static bool arg_in_cmdline(int argc, const char * const argv[],
> +			   const char *value)
> +{
> +	int i;
> +
> +	for (i = 0; i < argc; i++)
> +		if (!strcmp(argv[i], value))
> +			return true;
> +
> +	return false;
> +}
> +
>  static int mount_service_open_path(const struct mount_service *mo,
>  				   mode_t expected_fmt,
>  				   struct fuse_service_packet *p, size_t psz)
> @@ -1248,8 +1260,6 @@ static int mount_service_handle_mountpoint_cmd(struct mount_service *mo,
>  			container_of(p, struct fuse_service_mountpoint_command, p);
>  	char *mntpt;
>  	mode_t expected_fmt;
> -	bool foundit = false;
> -	int i;
>  
>  	if (psz < sizeof_fuse_service_mountpoint_command(1)) {
>  		fprintf(stderr, "%s: mount point command too small\n",
> @@ -1289,13 +1299,7 @@ static int mount_service_handle_mountpoint_cmd(struct mount_service *mo,
>  	}
>  
>  	/* Mountpoint must be mentioned in the caller's argument list */
> -	for (i = 0; i < argc; i++) {
> -		if (!strcmp(argv[i], oc->value)) {
> -			foundit = true;
> -			break;
> -		}
> -	}
> -	if (!foundit) {
> +	if (!arg_in_cmdline(argc, argv, oc->value)) {
>  		fprintf(stderr, "%s: mount point must be in command line arguments\n",
>  			mo->msgtag);
>  		return mount_service_send_reply(mo, EINVAL);
> 
> -- 
> 2.53.0
> 
> 
> 

  reply	other threads:[~2026-09-25 21:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 22:23 [PATCH 00/10] libfuse: Add mount service safety checks and tests Bernd Schubert
2026-09-24 22:23 ` Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 01/10] mount_service: move the command line check into arg_in_cmdline() Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 21:40   ` Darrick J. Wong [this message]
2026-09-24 22:23 ` [PATCH 02/10] mount_service: open only paths named on the command line Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:05   ` Darrick J. Wong
2026-09-28  9:19     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 03/10] mount_service: refuse OPEN after the MNTPT request Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:07   ` Darrick J. Wong
2026-09-28  9:21     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 04/10] util: give fuservicemount3 an absolute build-tree runpath Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:09   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 05/10] mount.fuse: free the options on the service mount return path Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:10   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 06/10] example/single_file: take no sector size from a regular backing file Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:13   ` Darrick J. Wong
2026-09-24 22:23 ` [PATCH 07/10] test: check which files fuservicemount3 opens for the server Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 08/10] test: check what fuservicemount3 refuses Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-24 22:23 ` [PATCH 09/10] test: mount the service examples through fuservicemount3 Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:25   ` Darrick J. Wong
2026-09-28  9:27     ` Bernd Schubert
2026-09-24 22:23 ` [PATCH 10/10] test: run mkfs.ext4 through the service examples Bernd Schubert
2026-09-24 22:23   ` Bernd Schubert via B4 Relay
2026-09-25 22:27   ` Darrick J. Wong
2026-09-28  9:30     ` Bernd Schubert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260925214036.GQ6253@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bernd@bsbernd.com \
    --cc=fuse-devel@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.