From patchwork Fri Sep 22 12:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13395701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12A66C04AAB for ; Fri, 22 Sep 2023 12:02:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07E1B6B02C5; Fri, 22 Sep 2023 08:02:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 004496B02C6; Fri, 22 Sep 2023 08:02:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0F046B02C7; Fri, 22 Sep 2023 08:02:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CBDCD6B02C5 for ; Fri, 22 Sep 2023 08:02:48 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A2CF7B4583 for ; Fri, 22 Sep 2023 12:02:48 +0000 (UTC) X-FDA: 81264096816.12.8C73DFE Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id C6A3920035 for ; Fri, 22 Sep 2023 12:02:45 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IO1dDP3e; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695384165; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7BA8QLNemiJIXUC+XXC0PAivfRO0j2uaFr7AQHg4nPM=; b=UE2+w09hleewaJcOsZmRs41ASdocfk3IhrZmkdLJhOeWgGPiv6A5yhn7fwWNmO0UsVRYsn pXxzvMO5OeYBbiWecF/dZUGh9jgkf2pRXSBQv3AeohXdvC0XNIHW5IFDiTFnJZjnDWm4PZ 0MNb1zoHHJdIjgyt3foVUpy85ahCJ1o= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IO1dDP3e; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695384165; a=rsa-sha256; cv=none; b=6I41ohNYuEZ8L4mfyNJcf0LUtXAIrhcpkVD/cHvXFCqM0JkyZzKqtaBSJsWsN3D5Botczz 2b0E1xfx27TKbti9UxUloxCX5C35+oH8m2T9lc4TlN9knfIvJu39jhcLHgVAKu6Yc0Q3KX D79wjBQQBoCThK88EGz8gdqOA2whHwA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7BA8QLNemiJIXUC+XXC0PAivfRO0j2uaFr7AQHg4nPM=; b=IO1dDP3etDIUgSVMHmWumrWh0mMiZgmUyegLeO+q9CzDv0dErv1wo9jMQjtpAZ1JMWsBKo UuXMPbxS/5vBiEN521ytolwruWcf5yr4L43lFZtaB32iMPRekwcNsyidZW4tAnpFVF73oN AgdUp0RrQ+8O5spKwi1Kl5yGF6TsEEo= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-578-VMVqFlzOOAy8DJUDv5pSRw-1; Fri, 22 Sep 2023 08:02:41 -0400 X-MC-Unique: VMVqFlzOOAy8DJUDv5pSRw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CD583816C82; Fri, 22 Sep 2023 12:02:40 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 590362156701; Fri, 22 Sep 2023 12:02:37 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Oswald Buddenhagen , Suren Baghdasaryan , Kuninori Morimoto , alsa-devel@alsa-project.org Subject: [PATCH v6 03/13] sound: Fix snd_pcm_readv()/writev() to use iov access functions Date: Fri, 22 Sep 2023 13:02:17 +0100 Message-ID: <20230922120227.1173720-4-dhowells@redhat.com> In-Reply-To: <20230922120227.1173720-1-dhowells@redhat.com> References: <20230922120227.1173720-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspam-User: X-Stat-Signature: urz17zjy7homa6uxycarbq7bxmwpj6mu X-Rspamd-Server: rspam07 X-Rspamd-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hytNfYM0Cy69Zc/1+Rh2L6d6DSqBELY9fynYRz/gmHz9q7K5NdED49dBgP/jNKg9KGrN4Qy4mfsH6XKOUNVdKJd/6hDK7SwzAqZqh0bHGIpoGbBTSCFesqZKf2+RepudS5ybBbj4pYww/EA/N/T5SEvi2azd5AKfVOp7Nok9OvpqvFWPColk63OdX0RLVR/E5Lvzoha9fhzwIeAf8dWRDAH2GjsB9DKmzYWoubDd2xOzFgsGo+8u2yUx18oK94tmfcWR8F1rK6DFQk3lXZT1Mtzh3Hg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Fix snd_pcm_readv()/writev() to use iov access functions rather than poking at the iov_iter internals directly. Signed-off-by: David Howells Reviewed-by: Jaroslav Kysela Reviewed-by: Takashi Iwai cc: Oswald Buddenhagen cc: Jens Axboe cc: Suren Baghdasaryan cc: Kuninori Morimoto cc: alsa-devel@alsa-project.org --- sound/core/pcm_native.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index bd9ddf412b46..9a69236fa207 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -3527,7 +3527,7 @@ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to) if (runtime->state == SNDRV_PCM_STATE_OPEN || runtime->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; - if (!to->user_backed) + if (!user_backed_iter(to)) return -EINVAL; if (to->nr_segs > 1024 || to->nr_segs != runtime->channels) return -EINVAL; @@ -3567,7 +3567,7 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from) if (runtime->state == SNDRV_PCM_STATE_OPEN || runtime->state == SNDRV_PCM_STATE_DISCONNECTED) return -EBADFD; - if (!from->user_backed) + if (!user_backed_iter(from)) return -EINVAL; if (from->nr_segs > 128 || from->nr_segs != runtime->channels || !frame_aligned(runtime, iov->iov_len))