Skip to content

Commit

Permalink
Drivers: hv: util: catch allocation errors
Browse files Browse the repository at this point in the history
Catch allocation errors in hvutil_transport_send.

Fixes: 14b50f8 ('Drivers: hv: util: introduce hv_utils_transport abstraction')

Signed-off-by: Olaf Hering <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
olafhering authored and gregkh committed Dec 15, 2015
1 parent 6dfb867 commit cdc0c0c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/hv/hv_utils_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cdc0c0c

Please sign in to comment.