Skip to content

Commit

Permalink
Drivers: hv: vmbus: Fix a bug in rescind processing in vmbus_close_in…
Browse files Browse the repository at this point in the history
…ternal()

When a channel has been rescinded, the close operation is a noop.
Restructure the code so we deal with the rescind condition after
we properly cleanup the channel. I would like to thank
Dexuan Cui <[email protected]> for observing this problem.
The current code leaks memory when the channel is rescinded.

The current char-next branch is broken and this patch fixes
the bug.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
kattisrinivasan authored and gregkh committed Mar 25, 2015
1 parent b4affbb commit f2eddbc
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/hv/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,15 +501,6 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
put_cpu();
}

/*
* If the channel has been rescinded; process device removal.
*/
if (channel->rescind) {
hv_process_channel_removal(channel,
channel->offermsg.child_relid);
return 0;
}

/* Send a closing message */

msg = &channel->close_msg.msg;
Expand Down Expand Up @@ -549,6 +540,12 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
free_pages((unsigned long)channel->ringbuffer_pages,
get_order(channel->ringbuffer_pagecount * PAGE_SIZE));

/*
* If the channel has been rescinded; process device removal.
*/
if (channel->rescind)
hv_process_channel_removal(channel,
channel->offermsg.child_relid);
return ret;
}

Expand Down

0 comments on commit f2eddbc

Please sign in to comment.