Skip to contentSkip to conversation

drm/hyperv: Don't overwrite dirt_needed value set by host

PATCH Applied Saurabh Sengar 4 participants 4 messages Sep 12, 2022 – Sep 23, 2022

Subsystems (5)
lore
Share & tools
lore

Saurabh Sengar

author maintainer
#0 lore raw

PATCH 1/1 drm/hyperv: Don't overwrite dirt_needed value set by host

Existing code is causing a race condition where dirt_needed value is already set by the host and gets overwritten with default value. Remove this default setting of dirt_needed, to avoid overwriting the value received in the channel callback set by vmbus_open. Removing this setting also means the default value for dirt_needed is changed to false as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.

---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +0 -2
index 4a8941fa0815..57d49a08b37f 100644
@@ -198,8 +198,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 	if (ret)
 		drm_warn(dev, "Failed to update vram location.\n");
 
-	hv->dirt_needed = true;
-
 	ret = hyperv_mode_config_init(hv);
 	if (ret)
 		goto err_vmbus_close;
Signature · 1 line
2.31.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

From: Saurabh Sengar <[email protected]>
Sent: Monday, September 12, 2022 8:33 AM
...
Existing code is causing a race condition where dirt_needed value is already set by the host and gets overwritten with default value. Remove this default setting of dirt_needed, to avoid overwriting the value received in the channel callback set by vmbus_open. Removing this setting also means the default value for dirt_needed is changed to false as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Saurabh Sengar

From: Saurabh Sengar <[email protected]> Sent: Monday, September 12, 2022 8:33 AM

Quoted 28 lines

Existing code is causing a race condition where dirt_needed value is already set by the host and gets overwritten with default value. Remove this default setting of dirt_needed, to avoid overwriting the value received in the channel callback set by vmbus_open. Removing this setting also means the default value for dirt_needed is changed to false as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.

---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +0 -3
index 4a8941fa0815..57d49a08b37f 100644
@@ -198,8 +198,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 	if (ret)
 		drm_warn(dev, "Failed to update vram location.\n");
 
-	hv->dirt_needed = true;
-
 	ret = hyperv_mode_config_init(hv);
 	if (ret)
 		goto err_vmbus_close;
--
Quoted 1 line

2.31.1

maintainer Applied
#3 lore raw
In reply to Saurabh Sengar
Quoted 8 lines · Saurabh Sengar

Existing code is causing a race condition where dirt_needed value is already set by the host and gets overwritten with default value. Remove this default setting of dirt_needed, to avoid overwriting the value received in the channel callback set by vmbus_open. Removing this setting also means the default value for dirt_needed is changed to false as it's allocated by kzalloc which is similar to legacy hyperv_fb driver.

Applied to hyperv-next. Thanks.

I ended up reconstructing the patch myself since the said driver changed. It is only a one line change so that's fine. If the committed patch is wrong, please let me know.