usb: gadget: ether: Fix race between gether_disconnect and rx_submit
authorKiruthika Varadarajan <Kiruthika.Varadarajan@harman.com>
Tue, 18 Jun 2019 08:39:06 +0000 (08:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Jul 2019 07:06:01 +0000 (09:06 +0200)
commitf1052d05ec5ae9cb1138d43b447c2937adae56d3
tree83d02dd4f547be4688e16de6e2f57d9034f56155
parentfeca0ce34518f69447d0d13cd431d0eef647a794
usb: gadget: ether: Fix race between gether_disconnect and rx_submit

commit d29fcf7078bc8be2b6366cbd4418265b53c94fac upstream.

On spin lock release in rx_submit, gether_disconnect get a chance to
run, it makes port_usb NULL, rx_submit access NULL port USB, hence null
pointer crash.

Fixed by releasing the lock in rx_submit after port_usb is used.

Fixes: 2b3d942c4878 ("usb ethernet gadget: split out network core")
Cc: <stable@vger.kernel.org>
Signed-off-by: Kiruthika Varadarajan <Kiruthika.Varadarajan@harman.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/u_ether.c