summaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2023-06-19 05:06:31 +0200
committerBjorn Andersson <andersson@kernel.org>2023-07-15 23:59:30 +0200
commitb5c9ee8296a3760760c7b5d2e305f91412adc795 (patch)
treed55e444f7f3ec55250d9c2df58dba6bf546a2a62 /drivers/rpmsg
parentrpmsg: char: Add RPMSG GET/SET FLOWCONTROL IOCTL support (diff)
downloadlinux-b5c9ee8296a3760760c7b5d2e305f91412adc795.tar.xz
linux-b5c9ee8296a3760760c7b5d2e305f91412adc795.zip
rpmsg: glink: Add check for kstrdup
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Fixes: b4f8e52b89f6 ("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>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r--drivers/rpmsg/qcom_glink_native.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 2db82f67e689..e10c05ed21bb 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -227,6 +227,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);