summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2023-03-28 14:32:38 -0600
committerJens Axboe <axboe@kernel.dk>2023-03-30 08:12:29 -0600
commit23ecdcd0c070e200f52b58e131af2b276b3d800e (patch)
treea8d08bf85ceb9479f42402f8fa856f20f8eb5598
parentde4f5fed3f231a8ff4790bf52975f847b95b85ea (diff)
downloadlinux-stable-23ecdcd0c070e200f52b58e131af2b276b3d800e.tar.gz
linux-stable-23ecdcd0c070e200f52b58e131af2b276b3d800e.tar.bz2
linux-stable-23ecdcd0c070e200f52b58e131af2b276b3d800e.zip
IB/hfi1: check for user backed iterator, not specific iterator type
In preparation for switching single segment iterators to using ITER_UBUF, swap the check for whether we are user backed or not. While at it, move it outside the srcu locking area to clean up the code a bit. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 3065db9d6bb9..f3d6ce45c397 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -267,6 +267,8 @@ 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)
+ return -EINVAL;
idx = srcu_read_lock(&fd->pq_srcu);
pq = srcu_dereference(fd->pq, &fd->pq_srcu);
if (!cq || !pq) {
@@ -274,11 +276,6 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)
return -EIO;
}
- if (!iter_is_iovec(from) || !dim) {
- srcu_read_unlock(&fd->pq_srcu, idx);
- return -EINVAL;
- }
-
trace_hfi1_sdma_request(fd->dd, fd->uctxt->ctxt, fd->subctxt, dim);
if (atomic_read(&pq->n_reqs) == pq->n_max_reqs) {