* [PATCH] virtiofsd: Error on bad socket group name
@ 2021-10-14 12:25 Dr. David Alan Gilbert (git)
2021-10-18 12:52 ` [Virtio-fs] " Vivek Goyal
2021-10-25 18:47 ` Dr. David Alan Gilbert
0 siblings, 2 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2021-10-14 12:25 UTC (permalink / raw)
To: qemu-devel, virtio-fs; +Cc: xiagao
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Make the '--socket-group=' option fail if the group name is unknown:
./tools/virtiofsd/virtiofsd .... --socket-group=zaphod
vhost socket: unable to find group 'zaphod'
Reported-by: Xiaoling Gao <xiagao@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
tools/virtiofsd/fuse_virtio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index 8f4fd165b9..39eebffb62 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)
"vhost socket failed to set group to %s (%d): %m\n",
se->vu_socket_group, g->gr_gid);
}
+ } else {
+ fuse_log(FUSE_LOG_ERR,
+ "vhost socket: unable to find group '%s'\n",
+ se->vu_socket_group);
+ close(listen_sock);
+ umask(old_umask);
+ return -1;
}
}
umask(old_umask);
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Virtio-fs] [PATCH] virtiofsd: Error on bad socket group name
2021-10-14 12:25 [PATCH] virtiofsd: Error on bad socket group name Dr. David Alan Gilbert (git)
@ 2021-10-18 12:52 ` Vivek Goyal
2021-10-25 18:41 ` Dr. David Alan Gilbert
2021-10-25 18:47 ` Dr. David Alan Gilbert
1 sibling, 1 reply; 4+ messages in thread
From: Vivek Goyal @ 2021-10-18 12:52 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: virtio-fs, qemu-devel, xiagao
On Thu, Oct 14, 2021 at 01:25:54PM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Make the '--socket-group=' option fail if the group name is unknown:
>
> ./tools/virtiofsd/virtiofsd .... --socket-group=zaphod
> vhost socket: unable to find group 'zaphod'
>
> Reported-by: Xiaoling Gao <xiagao@redhat.com>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Hi Dave,
This looks good to me. Just a minor nit for code cleanup. It could
be done in a separate patch or sometime later as well.
Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
> ---
> tools/virtiofsd/fuse_virtio.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
> index 8f4fd165b9..39eebffb62 100644
> --- a/tools/virtiofsd/fuse_virtio.c
> +++ b/tools/virtiofsd/fuse_virtio.c
> @@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)
> "vhost socket failed to set group to %s (%d): %m\n",
> se->vu_socket_group, g->gr_gid);
> }
> + } else {
> + fuse_log(FUSE_LOG_ERR,
> + "vhost socket: unable to find group '%s'\n",
> + se->vu_socket_group);
> + close(listen_sock);
> + umask(old_umask);
^^^
> + return -1;
> }
> }
> umask(old_umask);
This umask() call could be moved little early right after bind() call and
that way we don't have to take care of calling umask(old_umask) in error
path if group name could not be found.
Vivek
> --
> 2.31.1
>
> _______________________________________________
> Virtio-fs mailing list
> Virtio-fs@redhat.com
> https://listman.redhat.com/mailman/listinfo/virtio-fs
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Virtio-fs] [PATCH] virtiofsd: Error on bad socket group name
2021-10-18 12:52 ` [Virtio-fs] " Vivek Goyal
@ 2021-10-25 18:41 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2021-10-25 18:41 UTC (permalink / raw)
To: Vivek Goyal; +Cc: virtio-fs, qemu-devel, xiagao
* Vivek Goyal (vgoyal@redhat.com) wrote:
> On Thu, Oct 14, 2021 at 01:25:54PM +0100, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> >
> > Make the '--socket-group=' option fail if the group name is unknown:
> >
> > ./tools/virtiofsd/virtiofsd .... --socket-group=zaphod
> > vhost socket: unable to find group 'zaphod'
> >
> > Reported-by: Xiaoling Gao <xiagao@redhat.com>
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> Hi Dave,
>
> This looks good to me. Just a minor nit for code cleanup. It could
> be done in a separate patch or sometime later as well.
>
> Reviewed-by: Vivek Goyal <vgoyal@redhat.com>
Thanks
> > ---
> > tools/virtiofsd/fuse_virtio.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
> > index 8f4fd165b9..39eebffb62 100644
> > --- a/tools/virtiofsd/fuse_virtio.c
> > +++ b/tools/virtiofsd/fuse_virtio.c
> > @@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)
> > "vhost socket failed to set group to %s (%d): %m\n",
> > se->vu_socket_group, g->gr_gid);
> > }
> > + } else {
> > + fuse_log(FUSE_LOG_ERR,
> > + "vhost socket: unable to find group '%s'\n",
> > + se->vu_socket_group);
> > + close(listen_sock);
> > + umask(old_umask);
> ^^^
> > + return -1;
> > }
> > }
> > umask(old_umask);
>
> This umask() call could be moved little early right after bind() call and
> that way we don't have to take care of calling umask(old_umask) in error
> path if group name could not be found.
One to fight another day.
> Vivek
> > --
> > 2.31.1
> >
> > _______________________________________________
> > Virtio-fs mailing list
> > Virtio-fs@redhat.com
> > https://listman.redhat.com/mailman/listinfo/virtio-fs
> >
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtiofsd: Error on bad socket group name
2021-10-14 12:25 [PATCH] virtiofsd: Error on bad socket group name Dr. David Alan Gilbert (git)
2021-10-18 12:52 ` [Virtio-fs] " Vivek Goyal
@ 2021-10-25 18:47 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert @ 2021-10-25 18:47 UTC (permalink / raw)
To: qemu-devel, virtio-fs; +Cc: xiagao
* Dr. David Alan Gilbert (git) (dgilbert@redhat.com) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Make the '--socket-group=' option fail if the group name is unknown:
>
> ./tools/virtiofsd/virtiofsd .... --socket-group=zaphod
> vhost socket: unable to find group 'zaphod'
>
> Reported-by: Xiaoling Gao <xiagao@redhat.com>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Queued
> ---
> tools/virtiofsd/fuse_virtio.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
> index 8f4fd165b9..39eebffb62 100644
> --- a/tools/virtiofsd/fuse_virtio.c
> +++ b/tools/virtiofsd/fuse_virtio.c
> @@ -999,6 +999,13 @@ static int fv_create_listen_socket(struct fuse_session *se)
> "vhost socket failed to set group to %s (%d): %m\n",
> se->vu_socket_group, g->gr_gid);
> }
> + } else {
> + fuse_log(FUSE_LOG_ERR,
> + "vhost socket: unable to find group '%s'\n",
> + se->vu_socket_group);
> + close(listen_sock);
> + umask(old_umask);
> + return -1;
> }
> }
> umask(old_umask);
> --
> 2.31.1
>
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-25 18:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14 12:25 [PATCH] virtiofsd: Error on bad socket group name Dr. David Alan Gilbert (git)
2021-10-18 12:52 ` [Virtio-fs] " Vivek Goyal
2021-10-25 18:41 ` Dr. David Alan Gilbert
2021-10-25 18:47 ` Dr. David Alan Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).