Revision 5d9b70f7d52eb14bb37861c663bae44de9521c35 authored by Mathias Nyman on 08 December 2017, 16:10:05 UTC, committed by Greg Kroah-Hartman on 08 December 2017, 17:26:34 UTC
Avoid null pointer dereference if some function is walking through the
devs array accessing members of a new virt_dev that is mid allocation.

Add the virt_dev to xhci->devs[i] _after_ the virt_device and all its
members are properly allocated.

issue found by KASAN: null-ptr-deref in xhci_find_slot_id_by_port

"Quick analysis suggests that xhci_alloc_virt_device() is not mutex
protected. If so, there is a time frame where xhci->devs[slot_id] is set
but not fully initialized. Specifically, xhci->devs[i]->udev can be NULL."

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent be6123d
History
File Mode Size
Design
00-INDEX -rw-r--r-- 935 bytes
NMI-RCU.txt -rw-r--r-- 4.2 KB
RTFP.txt -rw-r--r-- 82.8 KB
UP.txt -rw-r--r-- 5.6 KB
arrayRCU.txt -rw-r--r-- 5.1 KB
checklist.txt -rw-r--r-- 22.7 KB
listRCU.txt -rw-r--r-- 10.7 KB
lockdep-splat.txt -rw-r--r-- 4.8 KB
lockdep.txt -rw-r--r-- 4.4 KB
rcu.txt -rw-r--r-- 3.7 KB
rcu_dereference.txt -rw-r--r-- 12.0 KB
rcubarrier.txt -rw-r--r-- 12.8 KB
rculist_nulls.txt -rw-r--r-- 5.1 KB
rcuref.txt -rw-r--r-- 4.2 KB
stallwarn.txt -rw-r--r-- 15.1 KB
torture.txt -rw-r--r-- 13.4 KB
whatisRCU.txt -rw-r--r-- 38.8 KB

back to top