Skip to contentSkip to conversation

vhost_task: Fix vhost_task_create return value

PATCH Applied Mike Christie 4 participants 10 messages Mar 22, 2023 – Mar 25, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost_task: Fix vhost_task_create return value

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]
---
 kernel/vhost_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/vhost_task.c +1 -1
index 4b8aff160640..b7cbd66f889e 100644
@@ -88,7 +88,7 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), void *arg,
 
 	vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
 	if (!vtsk)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 	init_completion(&vtsk->exited);
 	vtsk->data = arg;
 	vtsk->fn = fn;
Signature · 6 lines
2.25.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 19 lines
---
 kernel/vhost_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/vhost_task.c +1 -1
index 4b8aff160640..b7cbd66f889e 100644
@@ -88,7 +88,7 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), void *arg,
 
 	vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
 	if (!vtsk)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 	init_completion(&vtsk->exited);
 	vtsk->data = arg;
 	vtsk->fn = fn;
Signature · 1 line
2.25.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#2 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]
Quoted 6 lines

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

#3 lore raw
Quoted 17 lines · Christian Brauner
Quoted 9 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]
Quoted 6 lines

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 4 lines

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

Hard to say how important, but I'd prefer that, yes.

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#4 lore raw
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Christian Brauner
Quoted 15 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 6 lines
Quoted 4 lines

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

Hard to say how important, but I'd prefer that, yes.

Ok, fold the fixup into

e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process

the series is now at:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
branch: kernel.user_worker

1a5f8090c6de vhost: move worker thread fields to new struct e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process 89c8e98d8cfb fork: allow kernel code to call copy_process 094717586bf7 fork: Add kernel_clone_args flag to ignore signals 11f3f500ec8a fork: add kernel_clone_args flag to not dup/clone files 54e6842d0775 fork/vm: Move common PF_IO_WORKER behavior to new flag c81cc5819faf kernel: Make io_thread and kthread bit fields 73e0c116594d kthread: Pass in the thread's name during creation cf587db2ee02 kernel: Allow a kernel thread's name to be set in copy_process e0a98139c162 csky: Remove kernel_thread declaration

#5 lore raw
Quoted 35 lines · Christian Brauner
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Christian Brauner
Quoted 15 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 6 lines
Quoted 4 lines

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

Hard to say how important, but I'd prefer that, yes.

Ok, fold the fixup into

e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process

the series is now at:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
branch: kernel.user_worker
Quoted 10 lines

1a5f8090c6de vhost: move worker thread fields to new struct e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process 89c8e98d8cfb fork: allow kernel code to call copy_process 094717586bf7 fork: Add kernel_clone_args flag to ignore signals 11f3f500ec8a fork: add kernel_clone_args flag to not dup/clone files 54e6842d0775 fork/vm: Move common PF_IO_WORKER behavior to new flag c81cc5819faf kernel: Make io_thread and kthread bit fields 73e0c116594d kthread: Pass in the thread's name during creation cf587db2ee02 kernel: Allow a kernel thread's name to be set in copy_process e0a98139c162 csky: Remove kernel_thread declaration

Thanks a lot! Mike could you give it a spin to make sure all is well?

Signature · 6 lines
MST

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
#6 lore raw
Quoted 47 lines · Michael S. Tsirkin
Quoted 35 lines · Christian Brauner
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Christian Brauner
Quoted 15 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 6 lines
Quoted 4 lines

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

Hard to say how important, but I'd prefer that, yes.

Ok, fold the fixup into

e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process

the series is now at:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
branch: kernel.user_worker
Quoted 10 lines

1a5f8090c6de vhost: move worker thread fields to new struct e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process 89c8e98d8cfb fork: allow kernel code to call copy_process 094717586bf7 fork: Add kernel_clone_args flag to ignore signals 11f3f500ec8a fork: add kernel_clone_args flag to not dup/clone files 54e6842d0775 fork/vm: Move common PF_IO_WORKER behavior to new flag c81cc5819faf kernel: Make io_thread and kthread bit fields 73e0c116594d kthread: Pass in the thread's name during creation cf587db2ee02 kernel: Allow a kernel thread's name to be set in copy_process e0a98139c162 csky: Remove kernel_thread declaration

Quoted 1 line

Thanks a lot! Mike could you give it a spin to make sure all is well?

Yeah, I'll review and retest over the weekend. If I hit any issues I'll let you guys know by monday.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#7 lore raw
In reply to Michael S. Tsirkin
Quoted 47 lines · Michael S. Tsirkin
Quoted 35 lines · Christian Brauner
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Christian Brauner
Quoted 15 lines · Michael S. Tsirkin
Quoted 7 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

The affected patch is not upstream yet, right?
I don't know if the tree in question allows rebases - linux-next does. So ideally it would be squashed to avoid issues during bisect. Still it's error path so I guess not a tragedy even without squashing.

Quoted 6 lines
Quoted 4 lines

I tend to not rebase once stuff has been in linux-next but I make exceptions as long as it's before -rc4. For now I've put the patch on top (see the other mail I sent) but if it's really important I can squash it after the weekend (I'll be mostly afk until then.).

Hard to say how important, but I'd prefer that, yes.

Ok, fold the fixup into

e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process

the series is now at:

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
branch: kernel.user_worker
Quoted 10 lines

1a5f8090c6de vhost: move worker thread fields to new struct e297cd54b3f8 vhost_task: Allow vhost layer to use copy_process 89c8e98d8cfb fork: allow kernel code to call copy_process 094717586bf7 fork: Add kernel_clone_args flag to ignore signals 11f3f500ec8a fork: add kernel_clone_args flag to not dup/clone files 54e6842d0775 fork/vm: Move common PF_IO_WORKER behavior to new flag c81cc5819faf kernel: Make io_thread and kthread bit fields 73e0c116594d kthread: Pass in the thread's name during creation cf587db2ee02 kernel: Allow a kernel thread's name to be set in copy_process e0a98139c162 csky: Remove kernel_thread declaration

Quoted 1 line

Thanks a lot! Mike could you give it a spin to make sure all is well?

Reviewed and tested the patches and it's all ok.

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by on v1 1/1
#8 lore raw
In reply to Mike Christie
Quoted 10 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Fixes 77feab3c4156 ("vhost_task: Allow vhost layer to use copy_process") # mainline only
Reported-by [email protected]

---
kernel/vhost_task.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
kernel/vhost_task.c +1 -1
index 4b8aff160640..b7cbd66f889e 100644
@@ -88,7 +88,7 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), void *arg,
 
 	vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
 	if (!vtsk)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 	init_completion(&vtsk->exited);
 	vtsk->data = arg;
 	vtsk->fn = fn;
Signature · 1 line
2.25.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#9 lore raw
In reply to Mike Christie
Quoted 5 lines · Mike Christie

vhost_task_create is supposed to return the vhost_task or NULL on failure. This fixes it to return the correct value when the allocation of the struct fails.

Applied, thanks!

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
branch: kernel.user_worker

[1/1] vhost_task: Fix vhost_task_create return value

      commit: cbc0fc3d37b88182c1454da02002cd7d99b4a28e