lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170426090502.GB4375@b29397-desktop>
Date:   Wed, 26 Apr 2017 17:05:02 +0800
From:   Peter Chen <peter.chen@....com>
To:     Jisheng Zhang <jszhang@...vell.com>
CC:     Stefan Wahren <stefan.wahren@...e.com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] usb: chipidea: udc: fix NULL pointer dereference if
 udc_start failed

On Wed, Apr 26, 2017 at 04:25:26PM +0800, Jisheng Zhang wrote:
> On Tue, 25 Apr 2017 17:21:59 +0200
> Stefan Wahren <stefan.wahren@...e.com> wrote:
> 
> > Am 25.04.2017 um 11:20 schrieb Peter Chen:
> > >    
> > >>>> 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.  
> > 
> > I'm not sure how easy it is to reproduce the issue.
> 
> It's easy to reproduce it (100%) on arm64 platforms after commit
> 1dccb598df549 ("arm64: simplify dma_get_ops"). This commit could
> make all dma related operations failed, then udc_start() would fail
> with -ENOMEM.
> 
> On other platforms, it's not easy.
> 
> > 
> > Shouldn't make a Fixes tag sense at least?
> 
> maybe 3f124d233e97 ("usb: chipidea: add role init and destroy APIs"

I will cc stable, thanks.

-- 

Best Regards,
Peter Chen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ