diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2025-01-19 03:26:49 +0000 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-01-19 07:28:37 -0700 |
commit | 561e3a0c40dc7e3ab7b0b3647a2b89eca16215d9 (patch) | |
tree | 9eb8aa80b5a4c403ef18a111225196988c5895df /io_uring | |
parent | bab4b2cca027fbc4effc0ef60615a35bfee96ad0 (diff) |
io_uring/fdinfo: fix io_uring_show_fdinfo() misuse of ->d_iname
Output of io_uring_show_fdinfo() has several problems:
* racy use of ->d_iname
* junk if the name is long - in that case it's not stored in ->d_iname
at all
* lack of quoting (names can contain newlines, etc. - or be equal to "<none>",
for that matter).
* lines for empty slots are pointless noise - we already have the total
amount, so having just the non-empty ones would carry the same information.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/fdinfo.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c index b214e5a407b5..f60d0a9d505e 100644 --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -211,10 +211,11 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file) if (ctx->file_table.data.nodes[i]) f = io_slot_file(ctx->file_table.data.nodes[i]); - if (f) - seq_printf(m, "%5u: %s\n", i, file_dentry(f)->d_iname); - else - seq_printf(m, "%5u: <none>\n", i); + if (f) { + seq_printf(m, "%5u: ", i); + seq_file_path(m, f, " \t\n\\"); + seq_puts(m, "\n"); + } } seq_printf(m, "UserBufs:\t%u\n", ctx->buf_table.nr); for (i = 0; has_lock && i < ctx->buf_table.nr; i++) { |