diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2014-08-27 19:25:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 02:30:38 -0400 |
commit | 98d731bb064a9d1817a6ca9bf8b97051334a7cfe (patch) | |
tree | e533c8a76a30911c6feb9e4ba04d8a51edb98fed | |
parent | 45d727cee9e200f5b351528b9fb063b69cf702c8 (diff) |
Drivers: hv: vmbus: Cleanup vmbus_close_internal()
Eliminate calls to BUG_ON() in vmbus_close_internal().
We have chosen to potentially leak memory, than crash the guest
in case of failures.
In this version of the patch I have addressed comments from
Dan Carpenter (dan.carpenter@oracle.com).
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/hv/channel.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index b4eebe34ca91..19bad59073e6 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c | |||
@@ -478,7 +478,7 @@ static void reset_channel_cb(void *arg) | |||
478 | channel->onchannel_callback = NULL; | 478 | channel->onchannel_callback = NULL; |
479 | } | 479 | } |
480 | 480 | ||
481 | static void vmbus_close_internal(struct vmbus_channel *channel) | 481 | static int vmbus_close_internal(struct vmbus_channel *channel) |
482 | { | 482 | { |
483 | struct vmbus_channel_close_channel *msg; | 483 | struct vmbus_channel_close_channel *msg; |
484 | int ret; | 484 | int ret; |
@@ -501,11 +501,28 @@ static void vmbus_close_internal(struct vmbus_channel *channel) | |||
501 | 501 | ||
502 | ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel)); | 502 | ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel)); |
503 | 503 | ||
504 | BUG_ON(ret != 0); | 504 | if (ret) { |
505 | pr_err("Close failed: close post msg return is %d\n", ret); | ||
506 | /* | ||
507 | * If we failed to post the close msg, | ||
508 | * it is perhaps better to leak memory. | ||
509 | */ | ||
510 | return ret; | ||
511 | } | ||
512 | |||
505 | /* Tear down the gpadl for the channel's ring buffer */ | 513 | /* Tear down the gpadl for the channel's ring buffer */ |
506 | if (channel->ringbuffer_gpadlhandle) | 514 | if (channel->ringbuffer_gpadlhandle) { |
507 | vmbus_teardown_gpadl(channel, | 515 | ret = vmbus_teardown_gpadl(channel, |
508 | channel->ringbuffer_gpadlhandle); | 516 | channel->ringbuffer_gpadlhandle); |
517 | if (ret) { | ||
518 | pr_err("Close failed: teardown gpadl return %d\n", ret); | ||
519 | /* | ||
520 | * If we failed to teardown gpadl, | ||
521 | * it is perhaps better to leak memory. | ||
522 | */ | ||
523 | return ret; | ||
524 | } | ||
525 | } | ||
509 | 526 | ||
510 | /* Cleanup the ring buffers for this channel */ | 527 | /* Cleanup the ring buffers for this channel */ |
511 | hv_ringbuffer_cleanup(&channel->outbound); | 528 | hv_ringbuffer_cleanup(&channel->outbound); |
@@ -514,7 +531,7 @@ static void vmbus_close_internal(struct vmbus_channel *channel) | |||
514 | free_pages((unsigned long)channel->ringbuffer_pages, | 531 | free_pages((unsigned long)channel->ringbuffer_pages, |
515 | get_order(channel->ringbuffer_pagecount * PAGE_SIZE)); | 532 | get_order(channel->ringbuffer_pagecount * PAGE_SIZE)); |
516 | 533 | ||
517 | 534 | return ret; | |
518 | } | 535 | } |
519 | 536 | ||
520 | /* | 537 | /* |