[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f9b02ce0-43be-56ab-f077-951b41d6a0e5@huawei.com>
Date: Tue, 8 Nov 2022 18:15:17 +0800
From: Yuan Can <yuancan@...wei.com>
To: Stefano Garzarella <sgarzare@...hat.com>
CC: <stefanha@...hat.com>, <mst@...hat.com>, <jasowang@...hat.com>,
<davem@...emloft.net>, <kvm@...r.kernel.org>,
<virtualization@...ts.linux-foundation.org>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH] vhost/vsock: Fix error handling in vhost_vsock_init()
在 2022/11/8 17:33, Stefano Garzarella 写道:
> On Tue, Nov 08, 2022 at 09:13:57AM +0000, Yuan Can wrote:
>> A problem about modprobe vhost_vsock failed is triggered with the
>> following log given:
>>
>> modprobe: ERROR: could not insert 'vhost_vsock': Device or resource busy
>>
>> The reason is that vhost_vsock_init() returns misc_register() directly
>> without checking its return value, if misc_register() failed, it returns
>> without calling vsock_core_unregister() on vhost_transport, resulting
>> the
>> vhost_vsock can never be installed later.
>> A simple call graph is shown as below:
>>
>> vhost_vsock_init()
>> vsock_core_register() # register vhost_transport
>> misc_register()
>> device_create_with_groups()
>> device_create_groups_vargs()
>> dev = kzalloc(...) # OOM happened
>> # return without unregister vhost_transport
>>
>> Fix by calling vsock_core_unregister() when misc_register() returns
>> error.
>
> Thanks for this fix!
>
>>
>> Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
>
> Is this the right tag?
>
> It seems to me that since the introduction of vhost-vsock we have the
> same problem (to be solved differently, because with the introduction
> of multi-transport we refactored the initialization functions).
>
> So should we use 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko")?
Thanks for pointing out this problem! I will use the correct tag in the
v2 patch.
--
Best regards,
Yuan Can
Powered by blists - more mailing lists