CVE-2026-99306: ceph: reject mdsmaps that claim more than CEPH_MAX_MDS ranks
In the Linux kernel, the following vulnerability has been resolved:
ceph: reject mdsmaps that claim more than CEPHMAXMDS ranks
checknewmap() sizes its export-target bitmap from CEPHMAXMDS but walks it with newmap->possiblemaxrank, which comes straight off the wire: cephmdsmapdecode() sets it to max(mnumactivemds, mmaxmds), then overwrites it with the size of the "in" set. Neither is bounded by CEPHMAXMDS, only by minfo allocating, so a monitor announcing more ranks than the bitmap holds makes testbit() read past the end of targets[]. The clearbit() loop above indexes the same bitmap, though it is additionally bounded by mdsc->maxsessions. The map arrives on the monitor connection, which is unauthenticated in legacy msgr mode.
CEPHMAXMDS is a protocol constant from src/mds/mdstypes.h, and the reserved inode ranges in super.h are laid out one rank apart over that span, so a map claiming more ranks is corrupt. Reject it where the rank space is established rather than letting the count reach checknewmap().
BUG: KASAN: stack-out-of-bounds in checknewmap (fs/ceph/mdsclient.c:5968) Read of size 8 at addr ffffc90000ac7798 by task kworker/1:2/127 Workqueue: ceph-msgr cephconworkfn Call Trace: <TASK> dumpstacklvl (lib/dumpstack.c:94 lib/dumpstack.c:120) printreport (mm/kasan/report.c:378 mm/kasan/report.c:482) kasanreport (mm/kasan/report.c:595) kasancheckrange (mm/kasan/generic.c:186 mm/kasan/generic.c:200) checknewmap (fs/ceph/mdsclient.c:5968) cephmdschandlemdsmap (fs/ceph/mdsclient.c:7060) extramondispatch (fs/ceph/super.c:802) mondispatch (net/ceph/monclient.c:1483) cephconprocessmessage (net/ceph/messenger.c:1424) cephconv1tryread (net/ceph/messengerv1.c:1430) cephconworkfn (net/ceph/messenger.c:1576) processonework (kernel/workqueue.c:3396) workerthread (kernel/workqueue.c:3479 kernel/workqueue.c:3560) kthread (kernel/kthread.c:436) retfromfork (arch/x86/kernel/process.c:158) retfromforkasm (arch/x86/entry/entry64.S:245) </TASK> The buggy address belongs to stack of task kworker/1:2/127 and is located at offset 288 in frame: checknewmap (fs/ceph/mdsclient.c:5846) This frame has 1 object: [32, 288) 'targets'