提交 5b2e0c1b 编写于 作者: A Alan 提交者: Martin K. Petersen

esas2r: Fix array overrun

Check the array size *before* dereferencing it with a user provided
offset.
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: NTomas Henzl <thenzl@redhat.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 5a51a7ab
......@@ -1360,14 +1360,15 @@ int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg)
if (ioctl->header.channel == 0xFF) {
a = (struct esas2r_adapter *)hostdata;
} else {
a = esas2r_adapters[ioctl->header.channel];
if (ioctl->header.channel >= MAX_ADAPTERS || (a == NULL)) {
if (ioctl->header.channel >= MAX_ADAPTERS ||
esas2r_adapters[ioctl->header.channel] == NULL) {
ioctl->header.return_code = IOCTL_BAD_CHANNEL;
esas2r_log(ESAS2R_LOG_WARN, "bad channel value");
kfree(ioctl);
return -ENOTSUPP;
}
a = esas2r_adapters[ioctl->header.channel];
}
switch (cmd) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册