USB: u_bam: Optimize usage of spin_lock around skb_pool
Spin lock is dropped before allocating skbs from free pool
and acquired again by the skb pool alloc/free APIs. Same is
the case when skbs are added back to the pool. Around most
of these calls USB state is not checked when spin lock is
re-acquired. This opens up a race condition where USB
might be disconnected (resulting in freeing skb pool) just
before re-acquiring spin_lock resulting in use after free
or list corruption. Fix this by moving spin_lock handling
to the caller of skb pool alloc/free APIs.
CRs-fixed: 655123
Change-Id: I6a4413e5a7803b81114a33d15c6727a5dad4c66f
Signed-off-by:
Manu Gautam <mgautam@codeaurora.org>
Loading
Please register or sign in to comment