From patchwork Mon Dec 16 09:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13909452 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE3F32AF03; Mon, 16 Dec 2024 09:34:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734341659; cv=none; b=rROwURgQYkHtiQMizbgeZzjMOVyrQyL9giO3yOEQ95UiI8QswFSJ6//MD5uumiBHAMuLplWPlFVVAYeWlF+Wv5PGrMlpWsnDqqH7ghYQzGcQyiXwDF00AmhvbCEw/hFPXKfBxQrxAj8tjbP9MyzX+xRmZop/mFd6KDeC74RdYqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734341659; c=relaxed/simple; bh=XdDNYSq8B20MH+60EYN/0jpm4mqUUEejEyYcZbSUXHA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=WcZRlJJVn52zfrJd+56uEUXVU5Yg1laBAHZ+4JBGa0wc1to1BK95MCiOsAvsmi04XY9Eg+aBYoXRenbwdduvrjlmX9k7lYz1HJvbu5QCmTpwj8eEiw+5cWlTZZ4yn/UFmfv62MGDlTEexreboAmV+zARNUxucFLa54BPY8h07O0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DA6DS6NZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DA6DS6NZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E1A2C4CED0; Mon, 16 Dec 2024 09:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734341655; bh=XdDNYSq8B20MH+60EYN/0jpm4mqUUEejEyYcZbSUXHA=; h=From:To:Cc:Subject:Date:From; b=DA6DS6NZljJZ3o6/Bb0Aa/pLgXkoCPIROO/92gKEdRCJ4o4bne47t84vBhFnm50Fk KPW7rkdIa6SbjZxexPY+XFHyhP/eR9GL4ZUQgIAwKyZ7HS/p3kx6JLJMFiNok3nL9H EcdfxgyVzFFAIaWwR2LbduOzfUBU9llXZ4GuNaWmhBM7G1UuihTXbi+6mTpbeTqV/P iGeUYbPw1P3WjR/30OUxYRZxFuWaQL+grrvlpkAyvnUYdteO/B9UtxJBpBrGTOlmFP CqUxlXqcHp4Dj7lNHzQOD7F0bsq2jLXMjrAzjUxD9tW9wuwwWWNfp/8dcRbWBuWldf hT0dYzCRpaM8Q== From: Arnd Bergmann To: Vinod Koul , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Cc: Arnd Bergmann , Yu Jiaoliang , Peter Ujfalusi , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Date: Mon, 16 Dec 2024 10:33:40 +0100 Message-Id: <20241216093410.377112-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann The compression offload code cannot be in a loadable module unless it imports that namespace: ERROR: modpost: module snd-compress uses symbol dma_buf_get from namespace DMA_BUF, but does not import it. ERROR: modpost: module snd-compress uses symbol dma_buf_put from namespace DMA_BUF, but does not import it. ERROR: modpost: module snd-compress uses symbol dma_buf_fd from namespace DMA_BUF, but does not import it. Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode") Signed-off-by: Arnd Bergmann Acked-by: Shengjiu Wang Acked-by: Vinod Koul --- sound/core/compress_offload.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 86ed2fbee0c8..ec2485c00e49 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -1247,6 +1247,7 @@ void snd_compr_task_finished(struct snd_compr_stream *stream, } EXPORT_SYMBOL_GPL(snd_compr_task_finished); +MODULE_IMPORT_NS("DMA_BUF"); #endif /* CONFIG_SND_COMPRESS_ACCEL */ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) From patchwork Mon Dec 16 09:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13909453 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 700462AF03; Mon, 16 Dec 2024 09:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734341662; cv=none; b=SWIEAHVq16O7GVKo9SyI2VGYRwvnIXAhgI2+B5UorJ7vXfMjsZcytrGDhNjkuX0gtjljLyjQT8NVB9jVexUaLyg2jWslbC4eaoU9micIKzfr+Sekml4B/To+VF+izsuWQ/UdcC/bO2D9imjdf5abd/y2FtKxoY562CMD3SEohxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734341662; c=relaxed/simple; bh=xWqkQMOo1r4aFmTSakPdz2zoa8VdVFbmcoxWJbGbCB4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g6avmnRdwrEza3xjZI58leGqPPdJkLJyS10tBJj9oRjKKbsQOYUDSJtZGLmdpecTBDrRpoJZOL9C4O5JbsohTEOOeyjWyl7F5ovcs0zC5iX29G8o7nQL08xXHcYzNRhEzyjNvkuZuy3JFVkXvkguSRTQK+IToKGj2dwmL8Ur6ak= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XbeP15Yi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XbeP15Yi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50A0BC4CEDD; Mon, 16 Dec 2024 09:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734341662; bh=xWqkQMOo1r4aFmTSakPdz2zoa8VdVFbmcoxWJbGbCB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbeP15Yi2d2NQRjgsRe6Ny1Fnb8SZAJ1FGS/LpT47CUuAle1IjYn+SqNBwaqdb4Xc UPwatUJNSsE0ohwt2mn/tA0hiZaVYAP5a+QUHqUUnbvXO15fzlhV8S35YthxkeEdfQ mOUVwaG2z/Bh/BY4DzU3ESagisSIaGQqi9uY/GwlXd4+DvMDCIiLhF/vzqtn+bcIH9 XDrtnEuh1IOjJSOIhW1JxutmXzmnRphGVzMbt1uDYwRd8jp+uYjj/hKo/5o2KAHtYz Ej64i5gyAM5j7F/6h5GOVBst7ULHSn6R+1K1kTCpy96g+5DGhtBKXGM1QHO7LEm0yF lJUWff0E2VofQ== From: Arnd Bergmann To: Vinod Koul , Jaroslav Kysela , Takashi Iwai , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Cc: Arnd Bergmann , Yu Jiaoliang , Peter Ujfalusi , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Date: Mon, 16 Dec 2024 10:33:41 +0100 Message-Id: <20241216093410.377112-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241216093410.377112-1-arnd@kernel.org> References: <20241216093410.377112-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnd Bergmann On some architectures, get_user() cannot read a 64-bit user variable: arm-linux-gnueabi-ld: sound/core/compress_offload.o: in function `snd_compr_ioctl': compress_offload.c:(.text.snd_compr_ioctl+0x538): undefined reference to `__get_user_bad' Use an equivalent copy_from_user() instead. Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode") Signed-off-by: Arnd Bergmann Acked-by: Shengjiu Wang Acked-by: Vinod Koul --- sound/core/compress_offload.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index ec2485c00e49..1d6769a66810 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -1180,9 +1180,9 @@ static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg if (stream->runtime->state != SNDRV_PCM_STATE_SETUP) return -EPERM; - retval = get_user(seqno, (__u64 __user *)arg); - if (retval < 0) - return retval; + retval = copy_from_user(&seqno, (__u64 __user *)arg, sizeof(seqno)); + if (retval) + return -EFAULT; retval = 0; if (seqno == 0) { list_for_each_entry_reverse(task, &stream->runtime->tasks, list)