ソースを参照

spu-kernel: 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:Id450948185de41158ac666d220c8123c24e3b7e1
Signed-off-by: rakegand <[email protected]>
rakegand 2 年 前
コミット
962930e5fe
1 ファイル変更6 行追加2 行削除
  1. 6 2
      drivers/spcom.c

+ 6 - 2
drivers/spcom.c

@@ -679,8 +679,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;
 }