Mike Christie
2023-Mar-22 18:56 UTC
[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: syzbot+6b27b2d2aba1c80cc13b at syzkaller.appspotmail.com Signed-off-by: Mike Christie <michael.christie at oracle.com> --- kernel/vhost_task.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c index 4b8aff160640..b7cbd66f889e 100644 --- a/kernel/vhost_task.c +++ b/kernel/vhost_task.c @@ -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; -- 2.25.1
Michael S. Tsirkin
2023-Mar-23 07:37 UTC
[PATCH 1/1] vhost_task: Fix vhost_task_create return value
On Wed, Mar 22, 2023 at 01:56:05PM -0500, Mike Christie wrote:> 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: syzbot+6b27b2d2aba1c80cc13b at syzkaller.appspotmail.com > Signed-off-by: Mike Christie <michael.christie at oracle.com>Acked-by: Michael S. Tsirkin <mst at redhat.com> 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.> --- > kernel/vhost_task.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c > index 4b8aff160640..b7cbd66f889e 100644 > --- a/kernel/vhost_task.c > +++ b/kernel/vhost_task.c > @@ -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; > -- > 2.25.1
Stefano Garzarella
2023-Mar-23 08:35 UTC
[PATCH 1/1] vhost_task: Fix vhost_task_create return value
On Wed, Mar 22, 2023 at 01:56:05PM -0500, Mike Christie wrote:>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: syzbot+6b27b2d2aba1c80cc13b at syzkaller.appspotmail.com >Signed-off-by: Mike Christie <michael.christie at oracle.com> >--- > kernel/vhost_task.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by: Stefano Garzarella <sgarzare at redhat.com>> >diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c >index 4b8aff160640..b7cbd66f889e 100644 >--- a/kernel/vhost_task.c >+++ b/kernel/vhost_task.c >@@ -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; >-- >2.25.1 >
Reasonably Related Threads
- [syzbot] [kernel?] general protection fault in vhost_task_start
- [PATCH 1/1] vhost_task: Fix vhost_task_create return value
- [PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
- [PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
- [syzbot] [kvm?] [net?] [virt?] general protection fault in vhost_work_queue