Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1764637rdh; Tue, 26 Sep 2023 02:57:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyS+YjFJkA+O5rML6FAcrSXPNkL4wXKQhQCSocZxlZZlX214L8Xu6NJfZE7tvtDFhBYr4h X-Received: by 2002:a67:db8d:0:b0:44d:4c28:55ca with SMTP id f13-20020a67db8d000000b0044d4c2855camr5293958vsk.16.1695722225740; Tue, 26 Sep 2023 02:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695722225; cv=none; d=google.com; s=arc-20160816; b=sMYaxjfdnuFCXVkvb0NZS7iKOhFpWNOwm53ye5myD0hKPMstoTcIa1NqvPGM4mUrpV 07RjfKeZRljfC/MMH4tnqexiseQ4eLCB97wtYh4Oe+rqoSwtiDOkEhN3AkfbXOIlzheK Q3bC0EXOL5bFwAbSXRZszy5u6CTv7zLDFOdEo6nckLskVAayeRUAXmyMHivAScaDz5Fw zMTgWdmMyx+FeyD30SQ9Q9JYTvV9J+JnMBjo5VOU2Snq1m4iAqv4Dyc8bLGwO/zXE6Fd /MMF6Gmpf0EnoOtISeq+AFqP0V6OlVeilyvoB1sPWJjD1S3JtA4LV/5SdsOQYIDxC1e6 Z4qg== 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=j/K7bby96tUMA/iC07lWusXqTlhgR9zlJgJ7++h0ZQI=; fh=3J0v3VaTENk/DMzc7JGGBW1QJC1sH7oD+abUVn63OZg=; b=Tm4oUCU+rsIbYGADqrwqWhrKsyFqwYnpsZWea+QSCOkc7Co0dWzrs6qj99CxfV6vUw GylDeLTqAlpIjNNobaGb3cMNAsUdca8aty9w86Lg4ncHdr8ti1/9YfQL2CFc/wZbNduC fesZZUbXrM4BuKSFlr6YFjcWwdO9bg0ZiAbttwoEDXFNtaMf2kh/vMF2lhW2GIHVfYwr YcojaXBr06viqa2saWeEy6AIAwIiwjJxzShntJwjRUYFn155f4OZQ9niIoMmNVhLBJOb E6Cdzn6NA+Gigs1GEGVpa3R/9QB9A7+OkTJyLSU1sgD1MF8/O98zURNpn4oM3FyIK1pe SItA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wy2BrDuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00563deb65f93si11657372pgb.200.2023.09.26.02.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 02:57:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wy2BrDuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id C5A5581143F6; Mon, 25 Sep 2023 05:05:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231585AbjIYMFK (ORCPT + 99 others); Mon, 25 Sep 2023 08:05:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbjIYMFE (ORCPT ); Mon, 25 Sep 2023 08:05:04 -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 8CD05109 for ; Mon, 25 Sep 2023 05:03:34 -0700 (PDT) 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=j/K7bby96tUMA/iC07lWusXqTlhgR9zlJgJ7++h0ZQI=; b=Wy2BrDuIBdOWuW/JMdd8d8EAQbvaHlIU1nErAsWoXfmucmq+PoMn/gaxvZyyB/022ppJcD q83IE/zF8/pPHBKbOAM1HlkZNvkDab4tv4uoEQjIBPHYAH5Quao7F1a+cQANJNySc5qkTP PVIz4oRU0i5JzhVLpI/cXhp/GN7TNSc= 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-322-N5vnkQuMM-ymsL1ps_d4Kg-1; Mon, 25 Sep 2023 08:03:29 -0400 X-MC-Unique: N5vnkQuMM-ymsL1ps_d4Kg-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 AC2E7802C1A; Mon, 25 Sep 2023 12:03:28 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB2892156701; Mon, 25 Sep 2023 12:03:25 +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, Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org Subject: [PATCH v7 04/12] infiniband: Use user_backed_iter() to see if iterator is UBUF/IOVEC Date: Mon, 25 Sep 2023 13:03:01 +0100 Message-ID: <20230925120309.1731676-5-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.6 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_H3,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 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 05:05:22 -0700 (PDT) Use user_backed_iter() to see if iterator is UBUF/IOVEC rather than poking inside the iterator. Signed-off-by: David Howells cc: Dennis Dalessandro cc: Jason Gunthorpe cc: Leon Romanovsky cc: linux-rdma@vger.kernel.org --- drivers/infiniband/hw/hfi1/file_ops.c | 2 +- drivers/infiniband/hw/qib/qib_file_ops.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index a5ab22cedd41..788fc249234f 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -267,7 +267,7 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from) if (!HFI1_CAP_IS_KSET(SDMA)) return -EINVAL; - if (!from->user_backed) + if (!user_backed_iter(from)) return -EINVAL; idx = srcu_read_lock(&fd->pq_srcu); pq = srcu_dereference(fd->pq, &fd->pq_srcu); diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 152952127f13..29e4c59aa23b 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c @@ -2244,7 +2244,7 @@ static ssize_t qib_write_iter(struct kiocb *iocb, struct iov_iter *from) struct qib_ctxtdata *rcd = ctxt_fp(iocb->ki_filp); struct qib_user_sdma_queue *pq = fp->pq; - if (!from->user_backed || !from->nr_segs || !pq) + if (!user_backed_iter(from) || !from->nr_segs || !pq) return -EINVAL; return qib_user_sdma_writev(rcd, pq, iter_iov(from), from->nr_segs);