ceph: zero the dir_entries memory when allocating it

This potentially will cause a bug in future if using an old ceph
version that sends a smaller inode struct, which can cause some members
to be skipped in handle_reply.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Xiubo Li 2022-02-17 16:15:42 +08:00 коммит произвёл Ilya Dryomov
Родитель ab58a5a1c0
Коммит 2941bf53f5
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -2202,7 +2202,8 @@ int ceph_alloc_readdir_reply_buffer(struct ceph_mds_request *req,
order = get_order(size * num_entries); order = get_order(size * num_entries);
while (order >= 0) { while (order >= 0) {
rinfo->dir_entries = (void*)__get_free_pages(GFP_KERNEL | rinfo->dir_entries = (void*)__get_free_pages(GFP_KERNEL |
__GFP_NOWARN, __GFP_NOWARN |
__GFP_ZERO,
order); order);
if (rinfo->dir_entries) if (rinfo->dir_entries)
break; break;