]> git.proxmox.com Git - mirror_ubuntu-eoan-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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 13 Mar 2020 05:19:20 +0000 (01:19 -0400)
commit59b7f4c1cd14c27fd9df1a813eb80d333ba9da3f
tree9d6a8461e9ef3bd147bfae8233e0e4b09db0757f
parent7260c81664976fa9e4510d1ba79a0a7cb8a5e31e
usb: gadget: f_ncm: Use atomic_t to track in-flight request

BugLink: https://bugs.launchpad.net/bugs/1867051
commit 5b24c28cfe136597dc3913e1c00b119307a20c7e upstream.

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: 40d133d7f542 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/gadget/function/f_ncm.c