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]
Date:	Tue, 10 Mar 2015 20:53:11 -0500
From:	Felipe Balbi <balbi@...com>
To:	Ruslan Bilovol <ruslan.bilovol@...il.com>
CC:	Alan Stern <stern@...land.harvard.edu>,
	"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: [PATCHv3 5/5] usb: gadget: udc-core: independent registration of
 gadgets and gadget drivers

Hi,

On Wed, Mar 11, 2015 at 02:21:38AM +0200, Ruslan Bilovol wrote:
> >> @@ -469,6 +488,16 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
> >>                       break;
> >>               }
> >>
> >> +     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;
> >> +                     }
> >> +     }
> >
> > If you add the list_init and list_del_init above, this loop won't be
> > needed.  You can just call list_del.
> 
> I disagree with this. This function is externally visible and we can't
> guarantee that some buggy code will not call it with uninitialized
> 'pending' list_head. For example, if it never called usb_gadget_probe_driver()
> but calls usb_gadget_unregister_driver().

those cases deserve to suffer a really painfull and horrible death by
means of a kernel oops ;-) Sure, defensive programming and all, but at
some point we need to consider certain cases ridiculous and just not do
anything about them, so people know that they need more coffee and
attention while writing code.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ