Skip to contentSkip to conversation

Drivers: hv: vmbus: Release cpu lock in error case

PATCH In review Saurabh Sengar 3 participants 3 messages Jun 9, 2022 – Jun 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drivers: hv: vmbus: Release cpu lock in error case

In case of invalid sub channel, release cpu lock before returning.

---
 drivers/hv/channel_mgmt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hv/channel_mgmt.c +1 -0
index 280b529..5b12040 100644
@@ -639,6 +639,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
 		 */
 		if (newchannel->offermsg.offer.sub_channel_index == 0) {
 			mutex_unlock(&vmbus_connection.channel_mutex);
+			cpus_read_unlock();
 			/*
 			 * Don't call free_channel(), because newchannel->kobj
 			 * is not initialized yet.
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw

From: Saurabh Sengar <[email protected]> Sent: Thursday, June 9, 2022 10:17 AM

Quoted 20 lines

In case of invalid sub channel, release cpu lock before returning.

---
 drivers/hv/channel_mgmt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hv/channel_mgmt.c +1 -0
index 280b529..5b12040 100644
@@ -639,6 +639,7 @@ static void vmbus_process_offer(struct vmbus_channel
 *newchannel)
 		 */
 		if (newchannel->offermsg.offer.sub_channel_index == 0) {
 			mutex_unlock(&vmbus_connection.channel_mutex);
+			cpus_read_unlock();
 			/*
 			 * Don't call free_channel(), because newchannel->kobj
Quoted 3 lines

* is not initialized yet.
--
1.8.3.1

maintainer
#2 lore raw
Quoted 18 lines · Michael Kelley (LINUX)

From: Saurabh Sengar <[email protected]> Sent: Thursday, June 9, 2022 10:17 AM

Quoted 17 lines

In case of invalid sub channel, release cpu lock before returning.

---
 drivers/hv/channel_mgmt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hv/channel_mgmt.c +0 -0
index 280b529..5b12040 100644
@@ -639,6 +639,7 @@ static void vmbus_process_offer(struct vmbus_channel
 *newchannel)
 		 */
 		if (newchannel->offermsg.offer.sub_channel_index == 0) {
 			mutex_unlock(&vmbus_connection.channel_mutex);
Quoted 9 lines
Quoted 6 lines
drivers/hv/channel_mgmt.c +1 -0
+			cpus_read_unlock();
 			/*
 			 * Don't call free_channel(), because newchannel->kobj

* is not initialized yet.
--
1.8.3.1

The bug comes from a949e86c0d780.

Added a Fixes tag and applied to hyperv-fixes. Thanks.