From patchwork Mon Sep 25 12:03:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13397690 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 B9E6DCE7A94 for ; Mon, 25 Sep 2023 12:03:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CA086B013B; Mon, 25 Sep 2023 08:03:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B4096B013E; Mon, 25 Sep 2023 08:03:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70B336B0140; Mon, 25 Sep 2023 08:03:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4C4E46B013B for ; Mon, 25 Sep 2023 08:03:36 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2745D1CA7A2 for ; Mon, 25 Sep 2023 12:03:36 +0000 (UTC) X-FDA: 81274985232.01.91BA34F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 09B842001A for ; Mon, 25 Sep 2023 12:03:33 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MSp2CwdP; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695643414; a=rsa-sha256; cv=none; b=3yAMZZRVjpECb4RGuvza+jYU3papQHwJjARBKWM2Fmi6dH7cDBVeF5THggFkopw6koI2jT Jrq4KCQxmKcLpxRDFpNpVUN9M3CFmgRdpR6yFOwQ/KghqPuiPwuOSToWHH/oqM8J4bHgin jd8y9+uEhRLlnxkl5Y7d1jznCC7gw0k= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MSp2CwdP; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695643414; 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=KtvPgzLRKna5WSHl5IfKeygGySwgF7BoI3qaANhbqW1vYP+RGXEMUpLJfXTGnHjf7OA26E TVcckzRCRmY9siGBDLJ0dZffwm9wlUF8eQG8wiV2VXxapclbCjKW/UW8ySoex1GbvJO7uW MKrE00vjzvkWZVSDfWTKolNHzXRnTUQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643413; 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=MSp2CwdPtH0l3YwVo3Vn6QrZPrKGkcGOhhcNdcQEixmQ8MJf5oHOGhgV8HFROtM7gnjV7k XuCfoM/Zkxo9NMo2gVJW+sDheFbhhRKvZ/FyHNHJ4D4eJDq13wtN2wsc9aghKy8D1Z92kf 6kITnKGEPjZ0Lb1ODm5cSZnG5+ncRs8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-443-3j0u1djBOj-K7pheSFVopw-1; Mon, 25 Sep 2023 08:03:26 -0400 X-MC-Unique: 3j0u1djBOj-K7pheSFVopw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 0B212811E88; Mon, 25 Sep 2023 12:03:25 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7101940C2064; Mon, 25 Sep 2023 12:03:22 +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 v7 03/12] sound: Fix snd_pcm_readv()/writev() to use iov access functions Date: Mon, 25 Sep 2023 13:03:00 +0100 Message-ID: <20230925120309.1731676-4-dhowells@redhat.com> In-Reply-To: <20230925120309.1731676-1-dhowells@redhat.com> References: <20230925120309.1731676-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 09B842001A X-Stat-Signature: ioxq9ba5h3emstnxn4co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6+BCjRKSuvvP5Zi9I763EH6+G8p5jWL2tn5cKnNC40yCZSrZixg6jjawOCHmm42iXUy0zwQgR5ZvghcBfxFq0lyHoEnKsD0Kr2YkTIKjwP9GgJMYDMn/6SPpQd8FVAsNFa1WoXqvzH+Ltly7MSVkYJdowtw6qspgdGTlngJ6hnFlhcjrdjPZX8dKmrTWPW7kV7KU0LjZuAQDQBUNCvT/DNeR8XlrG7BHbi5v67SMWvHRRt6VnM+JuAC/wC9LfGdiZmOut2pnTQqsDOyDWKLgFwiDEv3uPtLJGSJgCCShhkeiSDxD2CnWvF5tBenk3BUiPVHmD6sK/+I5YNZfVR4q27FbKe1LfdmeGqiGzXhwdJ6RDaW17jL0VBqLQaQX9wNlno0cGux9YNWf07IHiZwovn3lKJmRsSPezM+0x 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))