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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 2 Feb 2012 11:42:09 +0100 (CET)
From:	Peter Meerwald <pmeerw@...erw.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
cc:	linux-kernel@...r.kernel.org, lars@...afoo.de, rpurdie@...ys.net
Subject: Re: [PATCH v2] add LED driver for PCA9663 I2C chip


> Andrew Morton <akpm@...ux-foundation.org> wrote:
> > > +exit:
> > > +	while (i--) {
> > > +		led_classdev_unregister(&pca9633[i].led_cdev);
> > > +		cancel_work_sync(&pca9633[i].work);
> > > +	}
> > This (untested!) loop has an off-by-one error. 

> Well, it's partly wrong.  It's wrong for the cancel_work_sync() but not
> for the led_classdev_unregister().  The cancel_work_sync() can just be
> removed: we haven't scheduled any works yet.

there are 4 leds with get led_classdev_register()ed

wouldn't it be possible that someone is starting to use led1 while led3 has 
not been registered yet? if registration for led3 fails, the exit code 
(above) is called and there might be work scheduled

so (hypothetically):
register led1 -> ok
register led2 -> ok
use led1 (schedule work)
register led3 -> fail -> exit code

the code has been copied from other led drivers
I think there is no harm to keep cancel_work_sync()

p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)
--
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