Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdc0c0c9 authored by Olaf Hering's avatar Olaf Hering Committed by Greg Kroah-Hartman
Browse files

Drivers: hv: util: catch allocation errors



Catch allocation errors in hvutil_transport_send.

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

Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6dfb867c
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -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);
	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;