Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2904682rdb; Fri, 22 Sep 2023 11:31:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEslGloIjCZGrKhxouqmB204lbqQvNo4nRWZViJdxmzQaKV6I+QT1ZzHicFbVkWrQre0jja X-Received: by 2002:a05:6358:50c6:b0:139:d277:354d with SMTP id m6-20020a05635850c600b00139d277354dmr504758rwm.22.1695407509042; Fri, 22 Sep 2023 11:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695407508; cv=none; d=google.com; s=arc-20160816; b=g7HKfwDS7ng525krWDB1+E2s4vZ6K09lWDcZClgb/kV8z2NoK+k8Dz0QtRhCamGZ47 FSBQrIwuR63AOKfHTCHHXZdjPg1xPj0D23B+tRxLbMYqoKml6P19g5URPg8PsOt/0XHU nqfuI+HT1MxctfsSBnkNXxBYm9d6jHBB0Gis31iixn3X+jEzz7sZxdit2BLj4J11hDx2 3XG9rval6jwq/Db1vxYZNbkX21+Z8HCNPiDucvVSo4LJbFwyEvJHNt3mFa0fWQeSH6XF h+XVmP3MeOnRWvdlmwjzdMUWdbE0ZOa3HZVNEwelFiaB+IzVVTxBZso0SljiV/gwMCeM XcPQ== 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=yYC9EcgnpB7vuvZIO9z2g//Rd1BzJQRTE5x06GnhWKeZDCOrYBKCrARqsYO9y/LwuR IrWYKNmjwFo4hwx+7dJmH1cacyCl1Ik5P7bcjmpt9GR8zPVazWxq+WIlEFkVFTpqbDpK C9EKcUgmMBzNnmvpC+mLeTzahA+AlcLlbWs5t+PcglJuPZbXR7U02JcaI9z1qnePP5jy 7dmQHeYUpB6LYCCmQE9mPC1MY3pjlYxZwhcq4XELI0CaVM5vThYjq/G93SdVNZBms12t sF96LcgJcUd+8mBYZ46ZsZmviJd44P51NDaDquG1zRCTXZYKmDSalZ1msgR8gOPaSyRF +Vtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IRx7GXIG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id r15-20020a632b0f000000b00578ea9a0b97si4107152pgr.539.2023.09.22.11.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 11:31:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IRx7GXIG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 59D7F83B6F8C; Fri, 22 Sep 2023 05:03:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234005AbjIVMDn (ORCPT + 99 others); Fri, 22 Sep 2023 08:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233987AbjIVMDh (ORCPT ); Fri, 22 Sep 2023 08:03:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AF27100 for ; Fri, 22 Sep 2023 05:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384164; 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=IRx7GXIGJkFUV8slMfO0joaakyX03lhjwcKa3168wfsALPG/OMIA6mE/V3Uh/2UaJQtyg2 mMpaNLusO4gcIlb24nldK8WuhPKke+zi89+MZZmhXoAUBS5xNRqT4uPLyzmU3F3+tMKWzn RKAGi7xMtZJ6816InyjbOzkdCAo5X0Q= 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 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 05:03:50 -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))