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: 726061 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7355E7D0B1 for ; Fri, 22 Sep 2023 12:04:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 61E52E7D; Fri, 22 Sep 2023 14:03:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 61E52E7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695384283; bh=fPtAXis1fewUnUMnrSzi4Is3JaQCt/rG8aIHxDhOVbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=tAX5jmU0n0jILbcpm3WHRh2vC9hyV84CIukwYU8Wziazi/GqSubjGftD5bmCihdEW eK6SaIzdXfu/wJQ5hpt4SlOz2FltFpUrrkpgNflpslifiA09MiI7j6X1MeKymieN9L 9RtuAQ3ebKMgygtXiTt3IYU1XrbU8HbkDk/4kb/Q= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 70499F8025A; Fri, 22 Sep 2023 14:03:15 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CCC86F801F5; Fri, 22 Sep 2023 14:03:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B3A56F801F5; Fri, 22 Sep 2023 14:03:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CF30AF80124 for ; Fri, 22 Sep 2023 14:02:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CF30AF80124 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IO1dDP3e 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 Message-ID-Hash: HM3W3275VDQIRG3PJP3BOHOFAZ6XCSKX X-Message-ID-Hash: HM3W3275VDQIRG3PJP3BOHOFAZ6XCSKX X-MailFrom: dhowells@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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))