[PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

Dan Carpenter dan.carpenter at oracle.com
Mon Sep 21 16:17:08 UTC 2015


On Sun, Sep 06, 2015 at 08:00:10PM -0700, Greg KH wrote:
> On Sat, Sep 05, 2015 at 01:12:01PM +0100, Salah Triki wrote:
> > poll_tick is declared global, so dgnc_driver_pollrate_* need to
> > take the lock dgnc_poll_lock before accessing to this variable.
> 
> Really?  The scope of a variable doesn't matter if a lock is needed for
> it or not.
> 
> And this patch doesn't really do anything at all, I don't understand why
> it is needed, please explain.
> 

Salah has not replied.  He didn't reply to the previous email, but he
edited the changelog so maybe that was supposed to count as reply?

Anyway, all the reads of dgnc_poll_tick are protected, it was only the
write which wasn't.  It could race.  I think this patch is the right
thing.

regards,
dan carpenter



More information about the devel mailing list