mirror-linux/net/ceph
Raphael Zimmer 28b0a2ab8c libceph: Fix potential null-ptr-deref in decode_choose_args()
A message of type CEPH_MSG_OSD_MAP contains an OSD map that itself
contains a CRUSH map. When decoding this CRUSH map in crush_decode(), an
array of max_buckets CRUSH buckets is decoded, where some indices may
not refer to actual buckets and are therefore set to NULL. The received
CRUSH map may optionally contain choose_args that get decoded in
decode_choose_args(). When decoding a crush_choose_arg_map, a series of
choose_args for different buckets is decoded, with the bucket_index
being read from the incoming message. It is only checked that the bucket
index does not exceed max_buckets, but not that it doesn't point to an
index with a NULL bucket. If a (potentially corrupted) message contains
a crush_choose_arg_map including such a bucket_index, a null pointer
dereference may occur in the subsequent processing when attempting to
access the bucket with the given index.

This patch fixes the issue by extending the affected check. Now, it is
only attempted to access the bucket if it is not NULL.

Cc: stable@vger.kernel.org
Signed-off-by: Raphael Zimmer <raphael.zimmer@tu-ilmenau.de>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
2026-05-12 21:00:59 +02:00
..
crush libceph: Fix potential out-of-bounds access in crush_decode() 2026-05-11 10:39:21 +02:00
Kconfig libceph: add support for CEPH_CRYPTO_AES256KRB5 2026-02-09 12:29:22 +01:00
Makefile libceph, ceph: implement msgr2.1 protocol (crc and secure modes) 2020-12-14 23:21:50 +01:00
armor.c
auth.c libceph: Fix slab-out-of-bounds access in auth message processing 2026-04-22 01:40:23 +02:00
auth_none.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
auth_none.h libceph: kill ceph_none_authorizer::reply_buf 2021-06-28 23:49:25 +02:00
auth_x.c libceph: Fix potential out-of-bounds access in __ceph_x_decrypt() 2026-05-11 10:39:22 +02:00
auth_x.h
auth_x_protocol.h libceph: add support for CEPH_CRYPTO_AES256KRB5 2026-02-09 12:29:22 +01:00
buffer.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ceph_common.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ceph_hash.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ceph_strings.c libceph: introduce connection modes and ms_mode option 2020-12-14 23:21:50 +01:00
cls_lock_client.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
crypto.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
crypto.h libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing 2026-02-09 12:29:22 +01:00
debugfs.c libceph: fix potential use-after-free in have_mon_and_osd_map() 2025-11-26 23:29:10 +01:00
decode.c libceph: allow addrvecs with a single NONE/blank address 2021-05-04 16:06:15 +02:00
messenger.c libceph: update outdated comment in ceph_sock_write_space() 2026-04-22 01:40:22 +02:00
messenger_v1.c libceph: add empty check to ceph_con_get_out_msg() 2025-10-08 23:30:47 +02:00
messenger_v2.c libceph: Remove obsolete session key alignment logic 2026-04-22 01:40:22 +02:00
mon_client.c libceph: Fix slab-out-of-bounds access in auth message processing 2026-04-22 01:40:23 +02:00
msgpool.c
osd_client.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
osdmap.c libceph: Fix potential null-ptr-deref in decode_choose_args() 2026-05-12 21:00:59 +02:00
pagelist.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
pagevec.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
snapshot.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 268 2019-06-05 17:30:29 +02:00
string_table.c
striper.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00