diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2012-12-11 14:07:17 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-17 14:58:00 -0500 |
commit | 33080c1cda280b918349c676cb75bedb6db4a772 (patch) | |
tree | d39ac12bf52348e0fd5f28d8f5cf7a8a0752190e /drivers/hv | |
parent | 6427a0d771dbf2a5cfbbed00caffbf1d11f4ae0b (diff) |
Drivers: hv: balloon: Fix a memory leak
The send buffer was being leaked; fix it.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Reported-by: Jason Wang <jasowang@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/hv_balloon.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index b9bb8f4c1c39..dd289fd179ca 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c | |||
@@ -883,7 +883,7 @@ static int balloon_probe(struct hv_device *dev, | |||
883 | balloon_onchannelcallback, dev); | 883 | balloon_onchannelcallback, dev); |
884 | 884 | ||
885 | if (ret) | 885 | if (ret) |
886 | return ret; | 886 | goto probe_error0; |
887 | 887 | ||
888 | dm_device.dev = dev; | 888 | dm_device.dev = dev; |
889 | dm_device.state = DM_INITIALIZING; | 889 | dm_device.state = DM_INITIALIZING; |
@@ -895,7 +895,7 @@ static int balloon_probe(struct hv_device *dev, | |||
895 | kthread_run(dm_thread_func, &dm_device, "hv_balloon"); | 895 | kthread_run(dm_thread_func, &dm_device, "hv_balloon"); |
896 | if (IS_ERR(dm_device.thread)) { | 896 | if (IS_ERR(dm_device.thread)) { |
897 | ret = PTR_ERR(dm_device.thread); | 897 | ret = PTR_ERR(dm_device.thread); |
898 | goto probe_error0; | 898 | goto probe_error1; |
899 | } | 899 | } |
900 | 900 | ||
901 | hv_set_drvdata(dev, &dm_device); | 901 | hv_set_drvdata(dev, &dm_device); |
@@ -918,12 +918,12 @@ static int balloon_probe(struct hv_device *dev, | |||
918 | VM_PKT_DATA_INBAND, | 918 | VM_PKT_DATA_INBAND, |
919 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 919 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
920 | if (ret) | 920 | if (ret) |
921 | goto probe_error1; | 921 | goto probe_error2; |
922 | 922 | ||
923 | t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); | 923 | t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); |
924 | if (t == 0) { | 924 | if (t == 0) { |
925 | ret = -ETIMEDOUT; | 925 | ret = -ETIMEDOUT; |
926 | goto probe_error1; | 926 | goto probe_error2; |
927 | } | 927 | } |
928 | 928 | ||
929 | /* | 929 | /* |
@@ -932,7 +932,7 @@ static int balloon_probe(struct hv_device *dev, | |||
932 | */ | 932 | */ |
933 | if (dm_device.state == DM_INIT_ERROR) { | 933 | if (dm_device.state == DM_INIT_ERROR) { |
934 | ret = -ETIMEDOUT; | 934 | ret = -ETIMEDOUT; |
935 | goto probe_error1; | 935 | goto probe_error2; |
936 | } | 936 | } |
937 | /* | 937 | /* |
938 | * Now submit our capabilities to the host. | 938 | * Now submit our capabilities to the host. |
@@ -965,12 +965,12 @@ static int balloon_probe(struct hv_device *dev, | |||
965 | VM_PKT_DATA_INBAND, | 965 | VM_PKT_DATA_INBAND, |
966 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); | 966 | VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); |
967 | if (ret) | 967 | if (ret) |
968 | goto probe_error1; | 968 | goto probe_error2; |
969 | 969 | ||
970 | t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); | 970 | t = wait_for_completion_timeout(&dm_device.host_event, 5*HZ); |
971 | if (t == 0) { | 971 | if (t == 0) { |
972 | ret = -ETIMEDOUT; | 972 | ret = -ETIMEDOUT; |
973 | goto probe_error1; | 973 | goto probe_error2; |
974 | } | 974 | } |
975 | 975 | ||
976 | /* | 976 | /* |
@@ -979,18 +979,20 @@ static int balloon_probe(struct hv_device *dev, | |||
979 | */ | 979 | */ |
980 | if (dm_device.state == DM_INIT_ERROR) { | 980 | if (dm_device.state == DM_INIT_ERROR) { |
981 | ret = -ETIMEDOUT; | 981 | ret = -ETIMEDOUT; |
982 | goto probe_error1; | 982 | goto probe_error2; |
983 | } | 983 | } |
984 | 984 | ||
985 | dm_device.state = DM_INITIALIZED; | 985 | dm_device.state = DM_INITIALIZED; |
986 | 986 | ||
987 | return 0; | 987 | return 0; |
988 | 988 | ||
989 | probe_error1: | 989 | probe_error2: |
990 | kthread_stop(dm_device.thread); | 990 | kthread_stop(dm_device.thread); |
991 | 991 | ||
992 | probe_error0: | 992 | probe_error1: |
993 | vmbus_close(dev->channel); | 993 | vmbus_close(dev->channel); |
994 | probe_error0: | ||
995 | kfree(send_buffer); | ||
994 | return ret; | 996 | return ret; |
995 | } | 997 | } |
996 | 998 | ||
@@ -1003,6 +1005,7 @@ static int balloon_remove(struct hv_device *dev) | |||
1003 | 1005 | ||
1004 | vmbus_close(dev->channel); | 1006 | vmbus_close(dev->channel); |
1005 | kthread_stop(dm->thread); | 1007 | kthread_stop(dm->thread); |
1008 | kfree(send_buffer); | ||
1006 | 1009 | ||
1007 | return 0; | 1010 | return 0; |
1008 | } | 1011 | } |