[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100511182347.GA31831@oksana.dev.rtsoft.ru>
Date: Tue, 11 May 2010 22:23:47 +0400
From: Anton Vorontsov <cbouatmailru@...il.com>
To: Daniel Mack <daniel@...aq.de>
Cc: linux-kernel@...r.kernel.org,
David Woodhouse <dwmw2@...radead.org>,
Alexey Starikovskiy <astarikovskiy@...e.de>,
Len Brown <len.brown@...el.com>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
Matt Reimer <mreimer@...p.net>,
Evgeniy Polyakov <zbr@...emap.net>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 1/3] pda_power: add support for writeable properties
On Tue, May 11, 2010 at 07:58:12PM +0200, Daniel Mack wrote:
[...]
> Hmm, no. The code defaults to (S_IRUSR | S_IRGRP | S_IROTH) which is
> 0444, just like it was before. So there shouldn't be any regression. The
> mode is only changed if the psy defines a property_is_writeable()
> callback which returns 1. Or do I miss your point?
Yes, power_supply_attrs is a global array, and you shouldn't change
it between power_supply_register() calls.
If you don't see why it's a bad idea in general, think about it
other way, a race:
...someone registers psy0 with attr X marked as read-only...
...code flow stops before device_create_file(psy0, global->mode)..
[preempt]
...someone registers psy1 with attr X marked as writable...
...you set up global->mode to 0644...
[preempt again]
...we end up calling device_create_file(psy0, 0644)...
--
Anton Vorontsov
email: cbouatmailru@...il.com
irc://irc.freenode.net/bd2
--
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