Skip to content

Drivers: hv: vmbus: Fix a race condition in "_show" functions

Kimberly Brown linux-hyperv lkml 2 versions – Applied

Status from this message: Queued up, thanks Kimberly!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 10 repliesApplied
  2. v22 patches 3 repliesSuperseded

Changes in v3 from the cover letter

Patch 1: Drivers: hv: vmbus: Refactor chan->state if statement
- Added the “reviewed-by” line from v2.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/3Drivers: hv: vmbus: Refactor chan->state if statementdrivers/hv/vmbus_drv.c+12 -30 replies
2/3Drivers: hv: vmbus: Set ring_info field to 0 and remove memsetdrivers/hv/ring_buffer.c+1 -21 reply
3/3Drivers: hv: vmbus: Fix race condition with new ring_buffer_info mutexdrivers/hv/channel_mgmt.c drivers/hv/hyperv_vmbus.h drivers/hv/ring_buffer.c +2 more+79 -328 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMichael Kelley
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] Drivers: hv: vmbus: Fix a race condition in "_show" functions

This patchset fixes a race condition in the "_show" functions that access the channel ring buffers.

Changes in v3:
Patch 1: Drivers: hv: vmbus: Refactor chan->state if statement
- Added the “reviewed-by” line from v2.

Patch 2: Drivers: hv: vmbus: Set ring_info field to 0 and remove memset
- This patch is new. This change allows the new mutex locks in patch 3 to be initialized when the channel is initialized.

Patch 3: Drivers: hv: vmbus: Fix race condition with new
ring_buffer_info mutex
- Added two ring buffer info mutex locks instead of the single channel mutex lock that was proposed in v2.
- Changed the mutex acquire/release calls as needed for the new ring buffer info mutex locks.
- Updated the commit message.

Changes in v2:
- In v1, I proposed using “vmbus_connection.channel_mutex” in the “_show” functions to prevent the race condition. However, using this mutex could result in a deadlock, so a new approach is proposed in this patchset.
- Patch 1 is new and consists of refactoring an if statement.
- Patch 2 introduces a new mutex lock in the “vmbus_channel” struct, which is used to eliminate the race condition.

Kimberly Brown (3):
Drivers: hv: vmbus: Refactor chan->state if statement
Drivers: hv: vmbus: Set ring_info field to 0 and remove memset
Drivers: hv: vmbus: Fix race condition with new ring_buffer_info mutex

 drivers/hv/channel_mgmt.c |  2 +
 drivers/hv/hyperv_vmbus.h |  1 +
 drivers/hv/ring_buffer.c  | 22 ++++++++--
 drivers/hv/vmbus_drv.c    | 89 +++++++++++++++++++++++++++------------
 include/linux/hyperv.h    |  7 ++-
 5 files changed, 88 insertions(+), 33 deletions(-)
Signature · 1 line
2.17.1