]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: f_ncm: Use atomic_t to track in-flight request
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Thu, 9 Jan 2020 13:17:21 +0000 (13:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2020 09:40:16 +0000 (10:40 +0100)
commit88bbfcab941ff6cd1d8773fef38a2cf35fa54534
treee1448eef314328154bc17074bc692860073fc5fd
parent6cc12d54dcc2900d7573ba77e799a5f0dff53052
usb: gadget: f_ncm: Use atomic_t to track in-flight request

Currently ncm->notify_req is used to flag when a request is in-flight.
ncm->notify_req is set to NULL and when a request completes it is
subsequently reset.

This is fundamentally buggy in that the unbind logic of the NCM driver will
unconditionally free ncm->notify_req leading to a NULL pointer dereference.

Fixes: c7370bc15057 ("usb: gadget: f_ncm: convert to new function interface with backward compatibility")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_ncm.c