Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1383802rdh; Mon, 25 Sep 2023 11:01:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG52XmTqEMgSGGnQ69Pt/P7wnHSJYVgA3vtbg2UkPYloh8jgHemW4ODlq+6luPZzQx2J4tQ X-Received: by 2002:a17:90a:4804:b0:276:cd68:6081 with SMTP id a4-20020a17090a480400b00276cd686081mr4719847pjh.40.1695664902029; Mon, 25 Sep 2023 11:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695664902; cv=none; d=google.com; s=arc-20160816; b=vFmrPFDEPmn+gL0K9fx3BX6Ja/3a903ghqzu/ZVeGouo6SS402NTTaGVTPIZ9ixdqd FDw0lphkDaoJYlQKkyS7sG8tEA2NfAgGJcTJeE7DrjAdulWUUzM0R/KskeyxM/WJ0LEm iJl+A2AmYVZvX2pkO+o22Ce2fK6Wau/Gb/IPspZTtWchby98IV+Lzdw/crI6Ktx9QsB3 viu6Wa0tUhjytTZDeLLVc66pel4rfQ1KwvVzl0vMK0qf3xNwTDinMzT3n1kfyv2GEXsO YJ7mtxG7/VUnKPGM6zd2J8S2/rKMp9Y78p3Sq5lQu24ivNYouHS9rXj4G1+pRbAHiRQ6 oMVw== 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=7BA8QLNemiJIXUC+XXC0PAivfRO0j2uaFr7AQHg4nPM=; fh=lb1tkH9yZ7UE4zvLFvhu51X3qw6YP3o4vGQleMrpKKg=; b=jD6Dm/qMM4wf+lZqHpN3CAvecPVf5MHl+iN/LwA6kqqz4Lnkjdcrn3ragCgrrIHjHt 9fJsYLdSPdFUduJSkhRIhe7VQSnC4Ccw97lscnNuTapiiehSOToilMgFnkeQ7sof2jZm R0o/JYZRP0eYyqz1quJmLy9TYmyt1DGaZS/uRH4ZnWOMaH4iW3ZAIrjdbr2kylfR3SGY JpGTPf7A2on8nkK8xO1X360wnnPX/W1ias8MZcurn/PmvMaPDjiE6BuzkNJcQ5SrP1il hGwROCvgt65diSKlPwyoWDoDd4bjHgq24WGiOhoh0pdR+9WJEgGcDZaIycqeaSB6e1Bq aoOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f+BzWF5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id on7-20020a17090b1d0700b0025de453ee4csi11931143pjb.168.2023.09.25.11.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 11:01:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f+BzWF5i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 4C9AD811F13C; Mon, 25 Sep 2023 05:04:54 -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 S231310AbjIYMEz (ORCPT + 99 others); Mon, 25 Sep 2023 08:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbjIYMEy (ORCPT ); Mon, 25 Sep 2023 08:04:54 -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 EE87F101 for ; Mon, 25 Sep 2023 05:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643410; 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=f+BzWF5imyFjr5mYr2vn0K7UtVAZH2km70CkpYI4hePs1WOv1INdh5oem9PosYELhW6Zkh 1pIHjw1GDFDUlCnfAgUr3KDl99Atq1DV/tdasa5AoytsijMIwDYk3857uomIOtisCiwzYM BS+9rZgxC2f4jCNUK3W0Ik8jcuX9e6w= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=ham 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]); Mon, 25 Sep 2023 05:04:54 -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 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))