xhci-mem.c: Check for ring->first_seg != NULL
commit697ec8fd0a3d6cbe8fd6d2bfb50f486f6239709c
authorKautuk Consul <consul.kautuk@gmail.com>
Mon, 19 Sep 2011 23:53:12 +0000 (19 16:53 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Nov 2011 17:42:21 +0000 (11 09:42 -0800)
tree916580f855e8be29969b8b7cd3ec892b87e2e2be
parentdc7623dab0940ea39408cb033a16b5f092c985a7
xhci-mem.c: Check for ring->first_seg != NULL

commit 0e6c7f746ea99089fb3263709075c20485a479ae upstream.

There are 2 situations wherein the xhci_ring* might not get freed:
- When xhci_ring_alloc() -> xhci_segment_alloc() returns NULL and
  we goto the fail: label in xhci_ring_alloc. In this case, the ring
  will not get kfreed.
- When the num_segs argument to xhci_ring_alloc is passed as 0 and
  we try to free the rung after that.
  ( This doesn't really happen as of now in the code but we seem to
    be entertaining num_segs=0 in xhci_ring_alloc )

This should be backported to kernels as old as 2.6.31.

Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/xhci-mem.c