mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
Drivers: hv: util: catch allocation errors
[ Upstream commitcdc0c0c94e] Catch allocation errors in hvutil_transport_send. Fixes:14b50f80c3('Drivers: hv: util: introduce hv_utils_transport abstraction') Signed-off-by: Olaf Hering <olaf@aepfle.de> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
10b8e4ebc4
commit
e35b50490e
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user