Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp914730pxb; Wed, 3 Mar 2021 20:53:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDaQZ29EAVg8LgMHoBiUdguzVVjFn3JdQ56VbqbECMVJnHREBdrYOooazp2algBbA/gZYu X-Received: by 2002:a17:906:4117:: with SMTP id j23mr2345832ejk.10.1614833638682; Wed, 03 Mar 2021 20:53:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614833638; cv=none; d=google.com; s=arc-20160816; b=odF2fqWNHTBCFOu1j6m/ENy1uOsEiq0cAoVJsWUQlptS4Py01G/4cUYvid9E1eVwUZ RThUeVutYIqduGWOWA903Q8Zn4mqrFSS9YMkC/J+wYyls8l6N5Zv4ENywqjodANABSTf Z/V12qhAAtKYr9zPnmVXPAnmh1ed/1EsJwspDfRzAV6nttFJ6cAWm3oXih4Z4JR4mTKk 6ujL+RqAYMtQTIbODbmswAvTbImY2A3MXR1v8PqUp1ftF++YhZsfkjRe6c1M7P9cOZZw 6pFuroFjMhbM2VhBUYQbD+qZtBsCJ7dPhzSoIg9FARFJJECN9nJiA+/icdLvKnfJbHww 4SnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PFC4aZw9nNWj1/veZFiVwd63c0pGEUZc2PAGShdTdEI=; b=w6GPDWBl9AFaeDUpBYZ9VrVdoGlzLLN8hIT5vZPU1fy/ZcfkVdWn618s5fEijBBV9K leQMtG5RAsYX5us4WYwuvaSdrN5YINmpDsZCRLOg4B3tVYYqjS8VI+jg1bGO0IhxBLOD lbMaeUTp6crrYGtVsBfahqLChxj34sJ0drDvKdftFsJQ6ktpblfn2ki5MDJLfNmapmmF oss5zN1pJ64WNoFV52JXvp4Kv2q1V7MZawvTmukEj4NN9C+kptz4341yRMG5IZfH/ctM 3ZEWsSxMk9NdsiIHWAy8TMlIayP77SWoleUDPb8oeXDzdePv7L1XZMwhYozac5c2fB/e cQhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kNbFdSpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si15713728edw.133.2021.03.03.20.53.36; Wed, 03 Mar 2021 20:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kNbFdSpP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442545AbhCBCOQ (ORCPT + 99 others); Mon, 1 Mar 2021 21:14:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:53018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241209AbhCATlU (ORCPT ); Mon, 1 Mar 2021 14:41:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 705B864EE8; Mon, 1 Mar 2021 17:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618811; bh=dHE4I/i4bvyOJ+qeRR6QKBP7TfSyNQjeJrUno7D2LDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNbFdSpPkSmU0Qt/c6ynwl2Q6wgyDc054oU796D2rJXj/N0J9LN0swe3olKmQc0sY RcaOzJZ+Sf/I5qkVQCT5U85/AklaSvUHegVtxa4I22s5xjb/O1rnjqtpdDjw7IZwH/ UuAFCL4vk8FBdrfwqtoag8edtuT+aqBE9DKKFBRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Hui Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.10 224/663] ASoC: SOF: debug: Fix a potential issue on string buffer termination Date: Mon, 1 Mar 2021 17:07:52 +0100 Message-Id: <20210301161152.882444302@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hui Wang [ Upstream commit 9037c3bde65d339017ef41d81cb58069ffc321d4 ] The function simple_write_to_buffer() doesn't add string termination at the end of buf, we need to handle it on our own. This change refers to the function tokenize_input() in debug.c and the function sof_dfsentry_trace_filter_write() in trace.c. Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood test") Reviewed-by: Kai Vehmanen Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20210208103857.75705-1-hui.wang@canonical.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 9419a99bab536..3ef51b2210237 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -350,7 +350,7 @@ static ssize_t sof_dfsentry_write(struct file *file, const char __user *buffer, char *string; int ret; - string = kzalloc(count, GFP_KERNEL); + string = kzalloc(count+1, GFP_KERNEL); if (!string) return -ENOMEM; -- 2.27.0