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

Commit efa7f316 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Greg Kroah-Hartman
Browse files

rpmsg: glink: Add check for kstrdup



[ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]

Add check for the return value of kstrdup() and return the error
if it fails in order to avoid NULL pointer dereference.

Fixes: b4f8e52b ("rpmsg: Introduce Qualcomm RPM glink driver")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230619030631.12361-1-jiasheng@iscas.ac.cn


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d2473df7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -222,6 +222,10 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink,

	channel->glink = glink;
	channel->name = kstrdup(name, GFP_KERNEL);
	if (!channel->name) {
		kfree(channel);
		return ERR_PTR(-ENOMEM);
	}

	init_completion(&channel->open_req);
	init_completion(&channel->open_ack);