public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Enric Balletbo Serra <eballetbo@gmail.com>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wim Van Sebroeck <wim@iguana.be>,
	Martyn Welch <martyn.welch@collabora.com>
Subject: Re: [PATCH v2] watchdog: ziirave_wdt: Add support to upload the firmware.
Date: Thu, 21 Jul 2016 06:24:53 -0700	[thread overview]
Message-ID: <5790CD25.5030002@roeck-us.net> (raw)
In-Reply-To: <CAFqH_52EajJV6BQzf=VqJZEVr=XZZgjRW7KfTdEehx=C8eDGoA@mail.gmail.com>

On 07/21/2016 01:59 AM, Enric Balletbo Serra wrote:

[ ... ]

>>>
>>> +static ssize_t ziirave_wdt_sysfs_store_firm(struct device *dev,
>>> +                                           struct device_attribute *attr,
>>> +                                           const char *buf, size_t count)
>>> +{
>>> +       struct i2c_client *client = to_i2c_client(dev->parent);
>>> +       struct ziirave_wdt_data *w_priv = i2c_get_clientdata(client);
>>> +       const struct firmware *fw;
>>> +       int err;
>>> +
>>
>>
>> What happens if this file is opened twice and written in parallel ?
>> What if any
>> other attribute is accessed while the firmware download is ongoing ?
>>
>
> Good point. So you think I need to protect all with mutexes or there

Yes, you have to protect any possible damaging parallel access with mutexes.

> is another way? From a quick look on other drivers i didn't see this
> kind of protection (something to look at in the future)
>

Really ? Can you point me to some examples ? This would be a bug.

You'll have to fix the to get your patch accepted. Pointing to other
examples with the same or a similar bug is not an argument.

Thanks,
Guenter

  parent reply	other threads:[~2016-07-21 13:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-20 10:31 [PATCH v2] watchdog: ziirave_wdt: Add support to upload the firmware Enric Balletbo i Serra
2016-07-21  3:42 ` Guenter Roeck
2016-07-21  8:59   ` Enric Balletbo Serra
2016-07-21  9:09     ` Enric Balletbo Serra
2016-07-21 13:24     ` Guenter Roeck [this message]
2016-07-21 13:40       ` Enric Balletbo Serra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5790CD25.5030002@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eballetbo@gmail.com \
    --cc=enric.balletbo@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=martyn.welch@collabora.com \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox