mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
Input: elan_i2c - validate firmware size before use
Ensure that the firmware file is large enough to contain the expected number of pages and the signature (which resides at the end of the firmware blob) before accessing them to prevent potential out-of-bounds reads. Cc: stable@vger.kernel.org Link: https://patch.msgid.link/ae2dOgiFvXRm4BHo@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
6cdc46b38c
commit
76b0d0baa9
|
|
@ -648,6 +648,11 @@ static ssize_t elan_sysfs_update_fw(struct device *dev,
|
|||
return error;
|
||||
}
|
||||
|
||||
if (fw->size < data->fw_signature_address + sizeof(signature)) {
|
||||
dev_err(dev, "firmware file too small\n");
|
||||
return -EBADF;
|
||||
}
|
||||
|
||||
/* Firmware file must match signature data */
|
||||
fw_signature = &fw->data[data->fw_signature_address];
|
||||
if (memcmp(fw_signature, signature, sizeof(signature)) != 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user