mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
NFSv4/pnfs: bound the CB_NOTIFY_DEVICEID array count before allocating
decode_devicenotify_args() hands the server's notification count
straight to kmalloc_objs() as the array length, without checking it
against the message that carried it. Bound it the way nfs4xdr.c bounds
an attribute length, against xdr_stream_remaining().
Fixes: 1be5683b03 ("pnfs: CB_NOTIFY_DEVICEID")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-fable-5
Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
This commit is contained in:
parent
0cc1191538
commit
32f0967ea2
|
|
@ -271,6 +271,13 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp,
|
|||
if (n == 0)
|
||||
goto out;
|
||||
|
||||
/* sanity check the count against the remaining stream */
|
||||
if (n > xdr_stream_remaining(xdr) /
|
||||
((4 * sizeof(uint32_t)) + NFS4_DEVICEID4_SIZE)) {
|
||||
status = htonl(NFS4ERR_BADXDR);
|
||||
goto out;
|
||||
}
|
||||
|
||||
args->devs = kmalloc_objs(*args->devs, n);
|
||||
if (!args->devs) {
|
||||
status = htonl(NFS4ERR_DELAY);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user