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: <Pine.LNX.4.44L0.1503161048170.1277-100000@iolanthe.rowland.org>
Date:	Mon, 16 Mar 2015 10:51:55 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Ruslan Bilovol <ruslan.bilovol@...il.com>
cc:	"Balbi, Felipe" <balbi@...com>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Krzysztof Opasiak <k.opasiak@...sung.com>,
	Peter Chen <peter.chen@...escale.com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	Andrzej Pietrasiewicz <andrzej.p@...sung.com>
Subject: Re: [PATCH v4 5/5] usb: gadget: udc-core: independent registration
 of gadgets and gadget drivers

On Mon, 16 Mar 2015, Ruslan Bilovol wrote:

> >> +     if (ret) {
> >> +             struct usb_gadget_driver *tmp;
> >> +
> >> +             list_for_each_entry(tmp, &gadget_driver_pending_list, pending)
> >> +                     if (tmp == driver) {
> >> +                             list_del(&driver->pending);
> >> +                             ret = 0;
> >> +                             break;
> >> +                     }
> >> +     }
> >
> > You could avoid this loop and simply do list_del(&driver->pending), if
> > you made sure driver->pending was initialized.
> 
> It would be good to avoid this loop but the question is how to make sure
> that driver->pending is not only initialized (prev and next are not NULL),
> but also contains valid data?

It's easy.  In usb_gadget_probe_driver() do
INIT_LIST_HEAD(&driver->pending), and in usb_gadget_remove_driver()  
replace your list_del() with list_del_init().

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ