[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <42e9b46219d8840f1f834092e58d54e8160fb414.camel@mediatek.com>
Date: Tue, 22 Oct 2024 03:10:36 +0000
From: Liju-clr Chen (陳麗如)
<Liju-clr.Chen@...iatek.com>
To: "hdanton@...a.com" <hdanton@...a.com>
CC: Ze-yu Wang (王澤宇) <Ze-yu.Wang@...iatek.com>,
"will@...nel.org" <will@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
Yingshiuan Pan (潘穎軒)
<Yingshiuan.Pan@...iatek.com>
Subject: Re: [PATCH v12 05/24] virt: geniezone: Add vm support
On Thu, 2024-08-01 at 18:50 +0800, Hillf Danton wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> On Tue, 30 Jul 2024 16:24:17 +0800 Liju-clr Chen <
> liju-clr.chen@...iatek.com>
> > +
> > +static void gzvm_destroy_vm(struct gzvm *gzvm)
> > +{
> > + pr_debug("VM-%u is going to be destroyed\n", gzvm->vm_id);
> > +
> > + mutex_lock(&gzvm->lock);
> > +
> > + gzvm_arch_destroy_vm(gzvm->vm_id);
> > +
> > + mutex_lock(&gzvm_list_lock);
> > + list_del(&gzvm->vm_list);
> > + mutex_unlock(&gzvm_list_lock);
> > +
> > + mutex_unlock(&gzvm->lock);
> > +
> > + kfree(gzvm);
> > +}
>
> ...
> > +
> > +void gzvm_destroy_all_vms(void)
> > +{
> > + struct gzvm *gzvm, *tmp;
> > +
> > + mutex_lock(&gzvm_list_lock);
> > + if (list_empty(&gzvm_list))
> > + goto out;
> > +
> > + list_for_each_entry_safe(gzvm, tmp, &gzvm_list, vm_list)
> > + gzvm_destroy_vm(gzvm);
> > +
>
> You add a fking deadlock by invoking gzvm_destroy_vm() with
> gzvm_list_lock held.
>
Hi Hillf,
Thank you for reviewing and finding the bug.
It will be fixed in next version.
> > +out:
> > + mutex_unlock(&gzvm_list_lock);
> > +}
BR
Liju
Powered by blists - more mailing lists