mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 11:55:37 +00:00
rpmsg: glink: Add check for kstrdup
[ Upstream commitb5c9ee8296
] Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Fixes:b4f8e52b89
("rpmsg: Introduce Qualcomm RPM glink driver") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20230619030631.12361-1-jiasheng@iscas.ac.cn Signed-off-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f309ac8a4d
commit
cae0787e40
1 changed files with 4 additions and 0 deletions
|
@ -224,6 +224,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);
|
||||
|
|
Loading…
Reference in a new issue