Skip to content

Commit 561e3a0

Browse files
Al Viroaxboe
authored andcommitted
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>
1 parent bab4b2c commit 561e3a0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

io_uring/fdinfo.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *file)
211211

212212
if (ctx->file_table.data.nodes[i])
213213
f = io_slot_file(ctx->file_table.data.nodes[i]);
214-
if (f)
215-
seq_printf(m, "%5u: %s\n", i, file_dentry(f)->d_iname);
216-
else
217-
seq_printf(m, "%5u: <none>\n", i);
214+
if (f) {
215+
seq_printf(m, "%5u: ", i);
216+
seq_file_path(m, f, " \t\n\\");
217+
seq_puts(m, "\n");
218+
}
218219
}
219220
seq_printf(m, "UserBufs:\t%u\n", ctx->buf_table.nr);
220221
for (i = 0; has_lock && i < ctx->buf_table.nr; i++) {

0 commit comments

Comments
 (0)