From 6380631f287ef87a12c1d494e24200dce6a02954 Mon Sep 17 00:00:00 2001 From: rakegand Date: Tue, 7 Mar 2023 11:53:20 +0530 Subject: [PATCH] soc: spcom: Addressing KASAN issue slab-out-of-bounds This change blocks access to channel name string, in case channel name string length is more than permissible limits. Change-Id: I2fe0b32498bc74011b1d42bb3c056c7e174494ca Signed-off-by: rakegand --- drivers/soc/qcom/spcom.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/spcom.c b/drivers/soc/qcom/spcom.c index a966ba98c30a..da3d5d352cc1 100644 --- a/drivers/soc/qcom/spcom.c +++ b/drivers/soc/qcom/spcom.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ /* @@ -631,8 +632,12 @@ static int spcom_handle_create_channel_command(void *cmd_buf, int cmd_size) mutex_lock(&spcom_dev->chdev_count_lock); ret = spcom_create_channel_chardev(cmd->ch_name, cmd->is_sharable); mutex_unlock(&spcom_dev->chdev_count_lock); - if (ret) - spcom_pr_err("failed to create ch[%s], ret [%d]\n", cmd->ch_name, ret); + if (ret) { + if (-EINVAL == ret) + spcom_pr_err("failed to create channel, ret [%d]\n", ret); + else + spcom_pr_err("failed to create ch[%s], ret [%d]\n", cmd->ch_name, ret); + } return ret; }