UPSTREAM: usb: gadget: composite: fix NULL pointer when a non standard request is received

In case usb configuration is unknown (cdev->config == NULL), non standard
request should not be processed.
Remove also the cdev->config check below which will never happen.

This issue was seen using ums feature.

Change-Id: I6930deeceadf0eff8e4bfbfb6fdfb254d47a4c83
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
(cherry picked from commit d57ed4d9f2cb6abc9438104f321b4fe3bc829d57)
This commit is contained in:
Christophe Kerello 2018-03-15 09:34:17 +01:00 committed by Frank Wang
parent 3056fcd356
commit 088d8eb9be
1 changed files with 4 additions and 1 deletions

View File

@ -951,6 +951,9 @@ unknown:
ctrl->bRequestType, ctrl->bRequest,
w_value, w_index, w_length);
if (!cdev->config)
goto done;
/*
* functions always handle their interfaces and endpoints...
* punt other recipients (other, WUSB, ...) to the current
@ -1001,7 +1004,7 @@ unknown:
value = f->setup(f, ctrl);
else {
c = cdev->config;
if (c && c->setup)
if (c->setup)
value = c->setup(c, ctrl);
}