diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2013-12-13 14:46:40 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-12-17 13:17:41 -0600 |
commit | 45ab460975c5433d1bd81b211fe643732abaae19 (patch) | |
tree | 56d8ebbf463d09a291b3168752491b8466876544 /drivers/usb/gadget/atmel_usba_udc.c | |
parent | e117e742d310683b410951faeab4b13b6c3c609f (diff) |
usb: gadget: nokia: fix error recovery path for optional functions
In the nokia gadget some USB functions (obex 1 and 2, phonet) are optional.
If at the start of nokia_bind_config e.g. fi_phonet is an error pointer,
which can happen because we don't fail the bind process if
usb_get_function_instance() fails for fi_phonet, then f_phonet is NULL, and
phonet_stat = usb_add_function(c, f_phonet);
is never called and phonet_stat remains 0.
If, in these circumstances, we hit the err_conf label then !phonet_stat
evaluates to true and we try usb_remove_function() with its second
parameter being f_phonet which is NULL and it causes NULL pointer
dereference.
This patch changes the initial values of (obex1|obex2|phonet)_stat to a
nonzero value so that if the err_conf label is hit while the respective
functions have not been acquired the usb_remove_function() is not called
for those functions.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
0 files changed, 0 insertions, 0 deletions