Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1843473rdb; Thu, 21 Sep 2023 00:40:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqYjU7xB2g2/NxBTp7295Y3wf3RQpd9cDDWcWBBEOdpeTCpJLc13RnbrAKUqNdQj48M/xs X-Received: by 2002:a17:902:b708:b0:1bc:e6a:205f with SMTP id d8-20020a170902b70800b001bc0e6a205fmr3843449pls.20.1695282018848; Thu, 21 Sep 2023 00:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695282018; cv=none; d=google.com; s=arc-20160816; b=pCI5WgCLing581Z/a7gvyrbxwrcEXuYcb9UW4gweLeyk4FjugMoTfckPnIHqglUaKW kjEnGOYi7Dci0g0ApVvVYCQzoSJV7nCggzv2HIhra0wTAFxMaXm+99gcQbk+DTFzV9iZ dqI8rxXP9EPq6NVAlOJBRdRxEORSU/YFQWlhJ5HAWiXFrGt8Mjl9A7f+JoPQyk8GxpTp zkx8DTsDxWhaNfJEmXvyeZDfq8osnoBp7ezFT/tGBRHyQ41+iF0Q/yMLnJjKC8i1eAMx hlLPrB4KYquedRn2J8Dyv9fKh+5aJiN7t0e+Z8iHjPp+OPW8B4gcmfAzoInaXOkcHF4g 7wWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wf1ilFnN40MCOQdTnir6rzgfTHWCDirDBrdNo7z0qfI=; fh=zzZ0RP5LNx83Kw6p61sYAeiNouvjCQdcFVmKlszPVVs=; b=Z49t88FQdk7dmmWSNc9l8Ktq25d04znvE4nXcNw0LNSskY0dypZjfxF38ef8X32czg rmpoSJilZ9x9RJpheFTylDI3i91Fn3g2QPldr5A8sOHWW8VQXAF7CGCQ8H4Jo01zpQiy qahX9QhfGIHT4xhw3j/YZVvm1Ezp27g/MOL4lOiubnLak3By2EDL8YZHNBnvRzVXDvs4 dxIO1NZKHOlcZxZ53nc7S7vGfEftWumeoPdJoxWds7sKV9EtLm0IY1C+L0avk5bsnfwV ZlVzdW622YEcMBj6yIM5vizltcb9yxNQ08XeY/9aaaTCQaxFk3N8DdxMV/BA+wcgRxFW x/ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IzRG3JPe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ij30-20020a170902ab5e00b001b3c7e6a8c0si803826plb.531.2023.09.21.00.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 00:40:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IzRG3JPe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9173B81D80BA; Wed, 20 Sep 2023 15:23:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjITWXi (ORCPT + 99 others); Wed, 20 Sep 2023 18:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjITWXh (ORCPT ); Wed, 20 Sep 2023 18:23:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF60D8 for ; Wed, 20 Sep 2023 15:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248565; 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=IzRG3JPetrAKVwwkU2l9S7yRpl8MkqV273gbY/jOCnVb7yCWRTZtLCcdYJgZsM4BbMVCeS 4N/wvDfAFm0t0KdLPAZfCXxFJL7f1lbEkAFrrZYaJzrYFGYdCxCtiDLdF6ppPC+s9uHvV9 VqiLQ7XjX+KZd6LUmVhzrxUtDy8/Ebo= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 20 Sep 2023 15:23:42 -0700 (PDT) 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 --- 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))