Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1630328
| From | Peter Chen <peter.chen@nxp.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed |
| Date | 2017-04-25 11:30 +0200 |
| Message-ID | <tA4Xf-2Ow-3@gated-at.bofh.it> (permalink) |
| References | <tzLBg-72B-29@gated-at.bofh.it> <tA4NA-2KQ-9@gated-at.bofh.it> <tA4Nz-2KQ-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
>> > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
>> > index f88e9157fad0..60a786c87c06 100644
>> > --- a/drivers/usb/chipidea/udc.c
>> > +++ b/drivers/usb/chipidea/udc.c
>> > @@ -1984,6 +1984,7 @@ static void udc_id_switch_for_host(struct
>> > ci_hdrc *ci) int ci_hdrc_gadget_init(struct ci_hdrc *ci) {
>> > struct ci_role_driver *rdrv;
>> > + int ret;
>> >
>> > if (!hw_read(ci, CAP_DCCPARAMS, DCCPARAMS_DC))
>> > return -ENXIO;
>> > @@ -1996,7 +1997,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci)
>> > rdrv->stop = udc_id_switch_for_host;
>> > rdrv->irq = udc_irq;
>> > rdrv->name = "gadget";
>> > - ci->roles[CI_ROLE_GADGET] = rdrv;
>> >
>> > - return udc_start(ci);
>> > + ret = udc_start(ci);
>> > + if (!ret)
>> > + ci->roles[CI_ROLE_GADGET] = rdrv;
>> > +
>> > + return ret;
>> > }
>> > --
>>
>> Thanks for fixing it. In fact, we'd better return failure if ret &&
>> ret != -ENXIO at probe, it stands for initialization for host or
>> gadget has failed.
>>
>
>I got your meaning. I'll cook v2. I don't have preference, since either one can fix the
>issue.
>
Both are needed, you don't need to send this one again. Only a new one, thanks.
Peter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed Jisheng Zhang <jszhang@marvell.com> - 2017-04-24 14:50 +0200
Re: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed Jisheng Zhang <jszhang@marvell.com> - 2017-04-25 11:20 +0200
RE: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed Peter Chen <peter.chen@nxp.com> - 2017-04-25 11:30 +0200
Re: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed Stefan Wahren <stefan.wahren@i2se.com> - 2017-04-25 17:30 +0200
Re: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if udc_start failed Jisheng Zhang <jszhang@marvell.com> - 2017-04-26 10:40 +0200
csiph-web