usb: gadget: f_hid: fix: Move IN request allocation to set_alt()
authorKrzysztof Opasiak <kopasiak90@gmail.com>
Tue, 24 Jan 2017 02:27:24 +0000 (03:27 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 23 Jul 2017 03:07:37 +0000 (03:07 +0000)
commitcbe2d4e6da4819dd6a55ae437f445fffe84266e6
tree3784b5db8124ad7dfb3f5ccddbbc42ce48b2a796
parente8100f7c7f5dd969db2d224433492c66276c56a2
usb: gadget: f_hid: fix: Move IN request allocation to set_alt()

Since commit: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()")
we cannot allocate any requests in bind() as we check if we should
align request buffer based on endpoint descriptor which is assigned
in set_alt().

Allocating request in bind() function causes a NULL pointer
dereference.

This commit moves allocation of IN request from bind() to set_alt()
to prevent this issue.

Fixes: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()")
Cc: stable@vger.kernel.org
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_hid.c