mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
libceph: Fix unsafe decode in ceph_redirect_decode()
ceph_redirect_decode handles unchecked data received over the network
from an OSD. Currently, there is only a bounds check covering the first
three decode operations. After decoding the first len field from the
message, the only remaining check ensures there is enough buffer space
to hold len bytes. However, there is no guarantee that this value is
large enough to hold the subsequently decoded fields. The decoding of
the second len field is missing an explicit bounds check. Consequently,
a corrupted message can trigger an out-of-bounds read.
This patch fixes the issue by switching the decoding from
ceph_decode_32() to the bounds-checked version ceph_decode_32_safe().
Cc: stable@vger.kernel.org
Fixes: 205ee1187a ("libceph: follow redirect replies from osds")
Assisted-by: Cursor
Signed-off-by: Raphael Zimmer <raphael.zimmer@tu-ilmenau.de>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
d6c7a5fcd0
commit
0405670e50
|
|
@ -3639,7 +3639,7 @@ static int ceph_redirect_decode(void **p, void *end,
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
len = ceph_decode_32(p);
|
||||
ceph_decode_32_safe(p, end, len, e_inval);
|
||||
if (len > 0) {
|
||||
pr_warn("ceph_request_redirect::object_name is set\n");
|
||||
goto e_inval;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user