Re: [PATCH next] vhost_task: after freeing vhost_task it should not be accessed in vhost_task_fn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 01, 2024 at 08:15:44AM +0800, Hillf Danton wrote:
> On Tue, Apr 30, 2024 at 11:23:04AM -0500, Mike Christie wrote:
> > On 4/30/24 8:05 AM, Edward Adam Davis wrote:
> > >  static int vhost_task_fn(void *data)
> > >  {
> > >  	struct vhost_task *vtsk = data;
> > > @@ -51,7 +51,7 @@ static int vhost_task_fn(void *data)
> > >  			schedule();
> > >  	}
> > >  
> > > -	mutex_lock(&vtsk->exit_mutex);
> > > +	mutex_lock(&exit_mutex);
> > >  	/*
> > >  	 * If a vhost_task_stop and SIGKILL race, we can ignore the SIGKILL.
> > >  	 * When the vhost layer has called vhost_task_stop it's already stopped
> > > @@ -62,7 +62,7 @@ static int vhost_task_fn(void *data)
> > >  		vtsk->handle_sigkill(vtsk->data);
> > >  	}
> > >  	complete(&vtsk->exited);
> > > -	mutex_unlock(&vtsk->exit_mutex);
> > > +	mutex_unlock(&exit_mutex);
> > >  
> > 
> > Edward, thanks for the patch. I think though I just needed to swap the
> > order of the calls above.
> > 
> > Instead of:
> > 
> > complete(&vtsk->exited);
> > mutex_unlock(&vtsk->exit_mutex);
> > 
> > it should have been:
> > 
> > mutex_unlock(&vtsk->exit_mutex);
> > complete(&vtsk->exited);
> 
> JFYI Edward did it [1]
> 
> [1] https://lore.kernel.org/lkml/tencent_546DA49414E876EEBECF2C78D26D242EE50A@xxxxxx/

and then it failed testing.

> > 
> > If my analysis is correct, then Michael do you want me to resubmit a
> > patch on top of your vhost branch or resubmit the entire patchset?





[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux