The following flaw was found in the Linux kernel's aacraid driver: I found this Double-Fetch bug in Linux-4.5/drivers/scsi/aacraid/commctrl.c when I was examining the source code. In function ioctl_send_fib(), the driver fetches user space data by pointer arg via copy_from_user(), and this happens twice at line 81 and line 116 respectively. The first fetched value (stored in kfib) is used to get the header and calculate the size at line 90 so as to copy the whole message later at line 116, which means the copy size of the whole message is based on the old value that came from the first fetch. Besides, the whole message copied in the second fetch also contains the header. However, when the function processes the message after the second fetch at line 130, it uses kfib->header.Size that came from the second fetch, which might be different from the one came from the first fetch as well as calculated the size to copy the message from user space to driver. If the kfib->header.Size is modified by a user thread under race condition between the fetch operations, for example changing to a very large value, this will lead to over-boundary access or other serious consequences in function aac_fib_send(). Upstream bug: https://bugzilla.kernel.org/show_bug.cgi?id=116751 Accepted upstream fix: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=fa00c437eef8dc2e7b25f8cd868cfa405fcc2bb3 References: http://seclists.org/bugtraq/2016/Aug/15 https://lkml.org/lkml/2016/4/26/1078 - discussion on lkml https://www.spinics.net/lists/linux-scsi/msg98681.html - discussion 1 https://www.spinics.net/lists/linux-scsi/msg98745.html - discussion 2 + patch https://www.spinics.net/lists/linux-scsi/msg98744.html - discussion 3 + patch v2
Created kernel tracking bugs for this issue: Affects: fedora-all [bug 1362467]
Statement: This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 5. This has been rated as having Moderate security impact and is not currently planned to be addressed in future updates. For additional information, refer to the Red Hat Enterprise Linux Life Cycle: https://access.redhat.com/support/policy/updates/errata/. This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 6, 7 and Red Hat Enterprise MRG-2. Future Linux kernel updates for the respective releases might address this issue.
kernel-4.7.2-201.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
kernel-4.7.2-101.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2016:2574 https://rhn.redhat.com/errata/RHSA-2016-2574.html
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2016:2584 https://rhn.redhat.com/errata/RHSA-2016-2584.html
This issue has been addressed in the following products: Red Hat Enterprise Linux 6 Via RHSA-2017:0817 https://rhn.redhat.com/errata/RHSA-2017-0817.html