mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 22:03:17 +01:00
thunderbolt: Clamp XDomain response data copy to allocation size
tb_xdp_properties_request() derives the per-packet copy length from
the response header without checking that it fits in the previously
allocated data buffer. A malicious peer can set its length field
larger than the declared data_length, causing memcpy to write past
the kcalloc allocation.
Clamp the per-packet copy length so that the cumulative offset
never exceeds data_len.
Fixes: cdae7c07e3 ("thunderbolt: Add support for XDomain properties")
Cc: [email protected]
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Michael Bommarito <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>
This commit is contained in:
1 parent
65423079c7
commit
322e93448d
1 file changed
+2
@@ -393,6 +393,8 @@ static int tb_xdp_properties_request(struct tb_ctl *ctl, u64 route,
|
||||
}
|
||||
}
|
||||
|
||||
if (req.offset + len > data_len)
|
||||
len = data_len - req.offset;
|
||||
memcpy(data + req.offset, res->data, len * 4);
|
||||
req.offset += len;
|
||||
} while (!data_len || req.offset < data_len);
|
||||
|
||||
Reference in new issue
Block a user