summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/hv/hv_utils_transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/hv/hv_utils_transport.c')
-rw-r--r--kernel/drivers/hv/hv_utils_transport.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/drivers/hv/hv_utils_transport.c b/kernel/drivers/hv/hv_utils_transport.c
index 6a9d80a53..1505ee6e6 100644
--- a/kernel/drivers/hv/hv_utils_transport.c
+++ b/kernel/drivers/hv/hv_utils_transport.c
@@ -204,9 +204,12 @@ int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len)
goto out_unlock;
}
hvt->outmsg = kzalloc(len, GFP_KERNEL);
- memcpy(hvt->outmsg, msg, len);
- hvt->outmsg_len = len;
- wake_up_interruptible(&hvt->outmsg_q);
+ if (hvt->outmsg) {
+ memcpy(hvt->outmsg, msg, len);
+ hvt->outmsg_len = len;
+ wake_up_interruptible(&hvt->outmsg_q);
+ } else
+ ret = -ENOMEM;
out_unlock:
mutex_unlock(&hvt->outmsg_lock);
return ret;