aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/entry_32.S
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2012-11-01 12:47:59 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-21 11:44:59 -0800
commit3b2167cc50f31531ee7cae375801489d1105d547 (patch)
treef1c3d98863b890803a079f5a511e4f15b7c10bef /arch/x86/kernel/entry_32.S
parent2ff95abca6fe594a7c9182d96fa4aa37997c4a86 (diff)
downloadkernel_samsung_smdk4412-3b2167cc50f31531ee7cae375801489d1105d547.zip
kernel_samsung_smdk4412-3b2167cc50f31531ee7cae375801489d1105d547.tar.gz
kernel_samsung_smdk4412-3b2167cc50f31531ee7cae375801489d1105d547.tar.bz2
xhci: fix null-pointer dereference when destroying half-built segment rings
commit 68e5254adb88bede68285f11fb442a4d34fb550c upstream. xhci_alloc_segments_for_ring() builds a list of xhci_segments and links the tail to head at the end (forming a ring). When it bails out for OOM reasons half-way through, it tries to destroy its half-built list with xhci_free_segments_for_ring(), even though it is not a ring yet. This causes a null-pointer dereference upon hitting the last element. Furthermore, one of its callers (xhci_ring_alloc()) mistakenly believes the output parameters to be valid upon this kind of OOM failure, and calls xhci_ring_free() on them. Since the (incomplete) list/ring should already be destroyed in that case, this would lead to a use after free. This patch fixes those issues by having xhci_alloc_segments_for_ring() destroy its half-built, non-circular list manually and destroying the invalid struct xhci_ring in xhci_ring_alloc() with a plain kfree(). This patch should be backported to kernels as old as 2.6.31, that contains the commit 0ebbab37422315a5d0cb29792271085bafdf38c0 "USB: xhci: Ring allocation and initialization." A separate patch will need to be developed for kernels older than 3.4, since the ring allocation code was refactored in that kernel. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> [bwh: Backported to 3.2: - Adjust context - Since segment allocation is done directly in xhci_ring_alloc(), walk the list starting from ring->first_seg when freeing] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: CAI Qian <caiqian@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86/kernel/entry_32.S')
0 files changed, 0 insertions, 0 deletions