From patchwork Wed Sep 20 22:22:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13393495 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 C350CCD13CF for ; Wed, 20 Sep 2023 22:22:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AF7D6B018E; Wed, 20 Sep 2023 18:22:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 45F356B0196; Wed, 20 Sep 2023 18:22:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 300966B019A; Wed, 20 Sep 2023 18:22:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1CEEE6B018E for ; Wed, 20 Sep 2023 18:22:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B4233C07F9 for ; Wed, 20 Sep 2023 22:22:46 +0000 (UTC) X-FDA: 81258401532.29.601C0B0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 1905C80022 for ; Wed, 20 Sep 2023 22:22:44 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gIG7h1J2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1695248565; 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=wf1ilFnN40MCOQdTnir6rzgfTHWCDirDBrdNo7z0qfI=; b=OkuNjpW25gion6HalkkQFfsK5s/r2uf1ra4FnN0qHJjJajVzGhH9BjeuCHhQO5Jqa3sCON fm5wZyFjME/oggsswUVuAVEbVxAIgS5hPCFse43TTyAFR3vTPq50ZHPoh9dmp+u/RRLHdU MJMWLiKA2Ac83FwCnb9k96Oywn9gmoo= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=gIG7h1J2; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf30.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695248565; a=rsa-sha256; cv=none; b=8YkSAnUUoX/SSf7Ut7tqqFZZqRvCFD3cDod/ZMKOtyp+Fuj4ZI8DxgN7v9ID5yXE64PAMd wP6xFZuhG2a+UMCxNzRZtL4nKUQt4BHhxZZ1CF0+kHJm5WwC0zq+m8ajNjBfTTrs5ydr+l CFII0R66MuuaPhDbCYU1wJf6FymOF68= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248564; 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=wf1ilFnN40MCOQdTnir6rzgfTHWCDirDBrdNo7z0qfI=; b=gIG7h1J2UsxpUbGt08CsIOjMXpr2i8JpQbWjd9/l2EBgNZ+lyd2FEopKlnbnXX5PDOHu80 IDb2+jMrlJwHcGfrSnDxmYPxfwuX1eUoOSNT+Y1gBpmCvBuKunmcdU7uwAys/5sOdts3vL j9VE+/MsMcesWsQlyvcGAubx16YOqJI= 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-163-wPPuppLQO0SLdceeEFMs3Q-1; Wed, 20 Sep 2023 18:22:41 -0400 X-MC-Unique: wPPuppLQO0SLdceeEFMs3Q-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 4219F800B35; Wed, 20 Sep 2023 22:22:40 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3AAA492B16; Wed, 20 Sep 2023 22:22:36 +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 v5 01/11] sound: Fix snd_pcm_readv()/writev() to use iov access functions Date: Wed, 20 Sep 2023 23:22:21 +0100 Message-ID: <20230920222231.686275-2-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-dhowells@redhat.com> References: <20230920222231.686275-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Queue-Id: 1905C80022 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: gojjunjo3wndax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eEtVrD7onQfWW4qkgj9RIZbTzdQ7s83L6Al682F2e3wzrY2CXrPdkQhG5Le7p0n1XnpTMhQ95qHIUVB1tVjseak4+O74YDA1mRGVkO/n2/dHaD8MQj20D014vGIExmfHlX4SHFb+UCXxp1U09XmI/kD9XOIdWIMqL8izbXQsEw1gLglfB8shnwlcKQuTnuVENU2KKDN69K4ovifCwt6LjiqzEc3Hfhll2W/+FUhEPOvs6U5QQSro4sczX2+wxWem/ryqDQhT12bElrpYEhbprY6IID12gNgVyQfikYIbT134dJXY/ZK8EmGEvwuBbxMHcxZjtq4GNfAM8fd9WoiSsrRaY 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 cc: Jaroslav Kysela cc: Takashi Iwai cc: Oswald Buddenhagen cc: Jens Axboe cc: Suren Baghdasaryan cc: Kuninori Morimoto cc: alsa-devel@alsa-project.org Reviewed-by: Jaroslav Kysela Reviewed-by: Takashi Iwai --- 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))