mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chunjie Zhu <chunjie.zhu@cloud.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Chunjie Zhu <chunjie.zhu@cloud.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] CA-392151: fix nfs gup uninitialized iov_offset defect
Date: Mon,  5 Aug 2024 07:58:14 +0000	[thread overview]
Message-ID: <20240805075814.10103-1-chunjie.zhu@cloud.com> (raw)

  nfs aio code path, iov_offset is not initialized before used

  nfs aio function call graph,
    io_submit
    aio_read
    aio_setup_rw
    import_single_range
    iov_iter_ubuf           # do not initialize iov_offset
    call_read_iter
    nfs_file_read
    nfs_file_direct_read
    nfs_direct_read_schedule_iovec
    iov_iter_get_pages_alloc2
    __iov_iter_get_pages_alloc
    first_iovec_segment     # iov_offset is used, not initialized

Signed-off-by: Chunjie Zhu <chunjie.zhu@cloud.com>
---
 include/linux/uio.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index 42bce38a8e87..2121424204c2 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -386,6 +386,7 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
 		.user_backed = true,
 		.data_source = direction,
 		.ubuf = buf,
+		.iov_offset = 0,
 		.count = count,
 		.nr_segs = 1
 	};
-- 
2.34.1


             reply	other threads:[~2024-08-05  7:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05  7:58 Chunjie Zhu [this message]
2024-08-05 14:13 ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240805075814.10103-1-chunjie.zhu@cloud.com \
    --to=chunjie.zhu@cloud.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®