RE: [PATCH] Drivers: hv: kvp/vss: Avoid accessing a ringbuffer not initialized yet

From: Dexuan Cui
Date: Thu Oct 31 2024 - 20:16:58 EST


> From: Michael Kelley <mhklinux@xxxxxxxxxxx>
> Sent: Wednesday, October 30, 2024 5:12 PM
> [...]
> What do you think about this (compile tested only), which splits the
> "init" function into two parts for devices that have char devs? I'm
> trying to avoid adding yet another synchronization point by just
> doing the init operations in the right order -- i.e., don't create the
> user space /dev entry until the VMBus channel is ready.
>
> Michael

Thanks, I think this works! This is a better fix.

> + if (srv->util_init_transport) {
> + ret = srv->util_init_transport();
> + if (ret) {
> + ret = -ENODEV;
IMO we don't need the line above, since the 'ret' from
srv->util_init_transport() is already a standard error code.

BTW, I noticed that the line "ret = -ENODEV;"
if (srv->util_init) {
ret = srv->util_init(srv);
if (ret) {
ret = -ENODEV;
goto error1;
}
}
I think we don't really need that line, either.
The existing 4 .util_init callbacks also already return a
standard error code. We can make a separate patch to clean
that up.

Thanks,
Dexuan