<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/hv/hv_util.c, branch linux-7.1.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-05T23:16:49+00:00</updated>
<entry>
<title>Drivers: hv: use kmalloc_array() instead of kmalloc()</title>
<updated>2025-12-05T23:16:49+00:00</updated>
<author>
<name>Gongwei Li</name>
<email>ligongwei@kylinos.cn</email>
</author>
<published>2025-11-21T03:10:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b5110eaf67530091343b519d8abd0cddd14660f2'/>
<id>urn:sha1:b5110eaf67530091343b519d8abd0cddd14660f2</id>
<content type='text'>
Replace kmalloc() with kmalloc_array() to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

Signed-off-by: Gongwei Li &lt;ligongwei@kylinos.cn&gt;
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet</title>
<updated>2024-12-09T18:44:15+00:00</updated>
<author>
<name>Michael Kelley</name>
<email>mhklinux@outlook.com</email>
</author>
<published>2024-11-06T15:42:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=07a756a49f4b4290b49ea46e089cbe6f79ff8d26'/>
<id>urn:sha1:07a756a49f4b4290b49ea46e089cbe6f79ff8d26</id>
<content type='text'>
If the KVP (or VSS) daemon starts before the VMBus channel's ringbuffer is
fully initialized, we can hit the panic below:

hv_utils: Registering HyperV Utility Driver
hv_vmbus: registering driver hv_utils
...
BUG: kernel NULL pointer dereference, address: 0000000000000000
CPU: 44 UID: 0 PID: 2552 Comm: hv_kvp_daemon Tainted: G E 6.11.0-rc3+ #1
RIP: 0010:hv_pkt_iter_first+0x12/0xd0
Call Trace:
...
 vmbus_recvpacket
 hv_kvp_onchannelcallback
 vmbus_on_event
 tasklet_action_common
 tasklet_action
 handle_softirqs
 irq_exit_rcu
 sysvec_hyperv_stimer0
 &lt;/IRQ&gt;
 &lt;TASK&gt;
 asm_sysvec_hyperv_stimer0
...
 kvp_register_done
 hvt_op_read
 vfs_read
 ksys_read
 __x64_sys_read

This can happen because the KVP/VSS channel callback can be invoked
even before the channel is fully opened:
1) as soon as hv_kvp_init() -&gt; hvutil_transport_init() creates
/dev/vmbus/hv_kvp, the kvp daemon can open the device file immediately and
register itself to the driver by writing a message KVP_OP_REGISTER1 to the
file (which is handled by kvp_on_msg() -&gt;kvp_handle_handshake()) and
reading the file for the driver's response, which is handled by
hvt_op_read(), which calls hvt-&gt;on_read(), i.e. kvp_register_done().

2) the problem with kvp_register_done() is that it can cause the
channel callback to be called even before the channel is fully opened,
and when the channel callback is starting to run, util_probe()-&gt;
vmbus_open() may have not initialized the ringbuffer yet, so the
callback can hit the panic of NULL pointer dereference.

To reproduce the panic consistently, we can add a "ssleep(10)" for KVP in
__vmbus_open(), just before the first hv_ringbuffer_init(), and then we
unload and reload the driver hv_utils, and run the daemon manually within
the 10 seconds.

Fix the panic by reordering the steps in util_probe() so the char dev
entry used by the KVP or VSS daemon is not created until after
vmbus_open() has completed. This reordering prevents the race condition
from happening.

Reported-by: Dexuan Cui &lt;decui@microsoft.com&gt;
Fixes: e0fa3e5e7df6 ("Drivers: hv: utils: fix a race on userspace daemons registration")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Kelley &lt;mhklinux@outlook.com&gt;
Acked-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Link: https://lore.kernel.org/r/20241106154247.2271-3-mhklinux@outlook.com
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Message-ID: &lt;20241106154247.2271-3-mhklinux@outlook.com&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: util: Don't force error code to ENODEV in util_probe()</title>
<updated>2024-12-09T18:44:14+00:00</updated>
<author>
<name>Michael Kelley</name>
<email>mhklinux@outlook.com</email>
</author>
<published>2024-11-06T15:42:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96e052d1473843d644ceba2adf46d3d2180b8ca7'/>
<id>urn:sha1:96e052d1473843d644ceba2adf46d3d2180b8ca7</id>
<content type='text'>
If the util_init function call in util_probe() returns an error code,
util_probe() always return ENODEV, and the error code from the util_init
function is lost. The error message output in the caller, vmbus_probe(),
doesn't show the real error code.

Fix this by just returning the error code from the util_init function.
There doesn't seem to be a reason to force ENODEV, as other errors
such as ENOMEM can already be returned from util_probe(). And the
code in call_driver_probe() implies that ENODEV should mean that a
matching driver wasn't found, which is not the case here.

Suggested-by: Dexuan Cui &lt;decui@microsoft.com&gt;
Signed-off-by: Michael Kelley &lt;mhklinux@outlook.com&gt;
Acked-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Link: https://lore.kernel.org/r/20241106154247.2271-2-mhklinux@outlook.com
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Message-ID: &lt;20241106154247.2271-2-mhklinux@outlook.com&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: Remove fcopy driver</title>
<updated>2024-04-11T12:55:53+00:00</updated>
<author>
<name>Saurabh Sengar</name>
<email>ssengar@linux.microsoft.com</email>
</author>
<published>2024-03-30T08:52:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ec314f61e4fc2d3dd6ea78aa18a5ac276eb1a8e3'/>
<id>urn:sha1:ec314f61e4fc2d3dd6ea78aa18a5ac276eb1a8e3</id>
<content type='text'>
As the new fcopy driver using uio is introduced, remove obsolete driver
and application.

Signed-off-by: Saurabh Sengar &lt;ssengar@linux.microsoft.com&gt;
Reviewed-by: Long Li &lt;longli@microsoft.com&gt;
Link: https://lore.kernel.org/r/1711788723-8593-7-git-send-email-ssengar@linux.microsoft.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hv_utils: Allow implicit ICTIMESYNCFLAG_SYNC</title>
<updated>2024-03-01T08:19:06+00:00</updated>
<author>
<name>Peter Martincic</name>
<email>pmartincic@microsoft.com</email>
</author>
<published>2023-11-27T21:35:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=adf47524b56a791734ae24da8412c6579e2fab4f'/>
<id>urn:sha1:adf47524b56a791734ae24da8412c6579e2fab4f</id>
<content type='text'>
Hyper-V hosts can omit the _SYNC flag to due a bug on resume from modern
suspend. In such a case, the guest may fail to update its time-of-day to
account for the period when it was suspended, and could proceed with a
significantly wrong time-of-day. In such a case when the guest is
significantly behind, fix it by treating a _SAMPLE the same as if _SYNC
was received so that the guest time-of-day is updated.

This is hidden behind param hv_utils.timesync_implicit.

Signed-off-by: Peter Martincic &lt;pmartincic@microsoft.com&gt;
Acked-by: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Link: https://lore.kernel.org/r/20231127213524.52783-1-pmartincic@linux.microsoft.com
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
Message-ID: &lt;20231127213524.52783-1-pmartincic@linux.microsoft.com&gt;
</content>
</entry>
<entry>
<title>Drivers: hv: Make remove callback of hyperv driver void returned</title>
<updated>2023-01-17T13:41:27+00:00</updated>
<author>
<name>Dawei Li</name>
<email>set_pte_at@outlook.com</email>
</author>
<published>2023-01-05T14:51:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96ec2939620c48a503d9c89865c0c230d6f955e4'/>
<id>urn:sha1:96ec2939620c48a503d9c89865c0c230d6f955e4</id>
<content type='text'>
Since commit fc7a6209d571 ("bus: Make remove callback return
void") forces bus_type::remove be void-returned, it doesn't
make much sense for any bus based driver implementing remove
callbalk to return non-void to its caller.

As such, change the remove function for Hyper-V VMBus based
drivers to return void.

Signed-off-by: Dawei Li &lt;set_pte_at@outlook.com&gt;
Link: https://lore.kernel.org/r/TYCP286MB2323A93C55526E4DF239D3ACCAFA9@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
</content>
</entry>
<entry>
<title>drivers: convert unsupported .adjfreq to .adjfine</title>
<updated>2022-10-31T11:14:16+00:00</updated>
<author>
<name>Jacob Keller</name>
<email>jacob.e.keller@intel.com</email>
</author>
<published>2022-10-28T11:04:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=73aa29a2b119619bbc1db87e8a8103f4b7e5a5db'/>
<id>urn:sha1:73aa29a2b119619bbc1db87e8a8103f4b7e5a5db</id>
<content type='text'>
A few PTP drivers implement a .adjfreq handler which indicates the
operation is not supported. Convert all of these to .adjfine.

Signed-off-by: Jacob Keller &lt;jacob.e.keller@intel.com&gt;
Acked-by: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: "K. Y. Srinivasan" &lt;kys@microsoft.com&gt;
Cc: Haiyang Zhang &lt;haiyangz@microsoft.com&gt;
Cc: Stephen Hemminger &lt;sthemmin@microsoft.com&gt;
Cc: Wei Liu &lt;wei.liu@kernel.org&gt;
Cc: Dexuan Cui &lt;decui@microsoft.com&gt;
Cc: Vivek Thampi &lt;vithampi@vmware.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>drivers: hv: Decouple Hyper-V clock/timer code from VMbus drivers</title>
<updated>2021-07-19T09:24:28+00:00</updated>
<author>
<name>Michael Kelley</name>
<email>mikelley@microsoft.com</email>
</author>
<published>2021-07-14T00:01:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=31e5e64694cf9879e63b2802007fa934f4131126'/>
<id>urn:sha1:31e5e64694cf9879e63b2802007fa934f4131126</id>
<content type='text'>
Hyper-V clock/timer code in hyperv_timer.c is mostly independent from
other VMbus drivers, but building for ARM64 without hyperv_timer.c
shows some remaining entanglements.  A default implementation of
hv_read_reference_counter can just read a Hyper-V synthetic register
and be independent of hyperv_timer.c, so move this code out and into
hv_common.c. Then it can be used by the timesync driver even if
hyperv_timer.c isn't built on a particular architecture.  If
hyperv_timer.c *is* built, it can override with a faster implementation.

Also provide stubs for stimer functions called by the VMbus driver when
hyperv_timer.c isn't built.

No functional changes.

Signed-off-by: Michael Kelley &lt;mikelley@microsoft.com&gt;
Link: https://lore.kernel.org/r/1626220906-22629-1-git-send-email-mikelley@microsoft.com
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
</content>
</entry>
<entry>
<title>hv_utils: Fix passing zero to 'PTR_ERR' warning</title>
<updated>2021-05-18T10:50:46+00:00</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2021-05-14T07:01:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c6a8625fa4c6b0a97860d053271660ccedc3d1b3'/>
<id>urn:sha1:c6a8625fa4c6b0a97860d053271660ccedc3d1b3</id>
<content type='text'>
Sparse warn this:

drivers/hv/hv_util.c:753 hv_timesync_init() warn:
 passing zero to 'PTR_ERR'

Use PTR_ERR_OR_ZERO instead of PTR_ERR to fix this.

Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Link: https://lore.kernel.org/r/20210514070116.16800-1-yuehaibing@huawei.com
[ wei: change %ld to %d ]
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
</content>
</entry>
<entry>
<title>hv_utils: Fix spelling mistake "Hearbeat" -&gt; "Heartbeat"</title>
<updated>2021-02-11T08:47:05+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2021-01-27T23:31:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bdb49526d25b076af4bd31b2fc66986ff0df1127'/>
<id>urn:sha1:bdb49526d25b076af4bd31b2fc66986ff0df1127</id>
<content type='text'>
There is a spelling mistake in an error message. Fix it.

Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Link: https://lore.kernel.org/r/20210127233136.623465-1-colin.king@canonical.com
Signed-off-by: Wei Liu &lt;wei.liu@kernel.org&gt;
</content>
</entry>
</feed>
