[PATCH] vhost: remove impossible check in VHOST_GET_FORK_FROM_OWNER ioctl

Cindy Lu posted 1 patch 1 week, 3 days ago
drivers/vhost/vhost.c | 5 -----
1 file changed, 5 deletions(-)
[PATCH] vhost: remove impossible check in VHOST_GET_FORK_FROM_OWNER ioctl
Posted by Cindy Lu 1 week, 3 days ago
remove impossible fork_owner check in VHOST_GET_FORK_FROM_OWNER ioctl

Fixes: 7d9896e9f6d02d8a ("vhost: Reintroduce kthread API and add mode selection")

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 drivers/vhost/vhost.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index bccdc9eab267..889481c92236 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -2338,11 +2338,6 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
 	if (ioctl == VHOST_GET_FORK_FROM_OWNER) {
 		u8 fork_owner_val = d->fork_owner;
 
-		if (fork_owner_val != VHOST_FORK_OWNER_TASK &&
-		    fork_owner_val != VHOST_FORK_OWNER_KTHREAD) {
-			r = -EINVAL;
-			goto done;
-		}
 		if (put_user(fork_owner_val, (u8 __user *)argp)) {
 			r = -EFAULT;
 			goto done;
-- 
2.51.0
Re: [PATCH] vhost: remove impossible check in VHOST_GET_FORK_FROM_OWNER ioctl
Posted by Jason Wang 1 week, 3 days ago
On Tue, Jan 27, 2026 at 3:39 PM Cindy Lu <lulu@redhat.com> wrote:
>
> remove impossible fork_owner check in VHOST_GET_FORK_FROM_OWNER ioctl
>
> Fixes: 7d9896e9f6d02d8a ("vhost: Reintroduce kthread API and add mode selection")
>
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
>  drivers/vhost/vhost.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index bccdc9eab267..889481c92236 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -2338,11 +2338,6 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp)
>         if (ioctl == VHOST_GET_FORK_FROM_OWNER) {
>                 u8 fork_owner_val = d->fork_owner;
>
> -               if (fork_owner_val != VHOST_FORK_OWNER_TASK &&
> -                   fork_owner_val != VHOST_FORK_OWNER_KTHREAD) {

There's another similar check in VHOST_SET_FORK_FROM_OWNER?

Thanks

> -                       r = -EINVAL;
> -                       goto done;
> -               }
>                 if (put_user(fork_owner_val, (u8 __user *)argp)) {
>                         r = -EFAULT;
>                         goto done;
> --
> 2.51.0
>