xhci: solve a double free problem while doing s4
when system is doing s4, the process of xhci_resume may be as below:
2、xhci_init->xhci_mem_init->xhci_mem_cleanup(when memory is not enough).
xhci_mem_cleanup will be executed twice when system is out of memory.
xhci->port_caps is freed in xhci_mem_cleanup,but it isn't set to NULL.
It will be freed twice when xhci_mem_cleanup is called the second time.
We got following bug when system resumes from s4:
kernel BUG at mm/slub.c:309!
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
CPU: 0 PID: 5929 Tainted: G S W 5.4.96-arm64-desktop #1
pc : __slab_free+0x5c/0x424
lr : kfree+0x30c/0x32c
Original patch that caused this issue was backported to 4.4 stable,
so this should be backported to 4.4 stabe as well.
Fixes: cf0ee7c60c89 ("xhci: Fix memory leak when caching protocol extended capability PSI tables - take 2")
Cc: firstname.lastname@example.org # v4.4+
Signed-off-by: Jiantao Zhang <email@example.com>
Signed-off-by: Tao Xue <firstname.lastname@example.org>
Signed-off-by: Mathias Nyman <email@example.com>
Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
1 file changed