All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Li Zhong <floridsleeves@gmail.com>, linux-hwmon@vger.kernel.org
Cc: jdelvare@suse.com
Subject: Re: [BUG] drivers: adm9240: possible data race bug in adm9240_fan_read()
Date: Wed, 21 Sep 2022 20:16:19 -0700	[thread overview]
Message-ID: <99ea1416-46dc-9712-271a-9e3daaa43e05@roeck-us.net> (raw)
In-Reply-To: <20220921233109.1672345-1-floridsleeves@gmail.com>

On 9/21/22 16:31, Li Zhong wrote:
> Hello,
> 
> My static analysis tool reports a possible bug in the adm9240 driver in Linux
> v6.0:
> 
> drivers/hwmon/adm9240.c:
> 
> adm9240_read()
>      adm9240_fan_read() --> Line 509
>          adm9240_write_fan_div()
> 
> adm9240_write_fan_div() says 'callers must hold
> data->update_lock'. However, it seems like the context does
> not hold the lock it requires. So it may cause data race when
> setting new fan div.
> 
> I am not quite sure whether this is a real bug. Any feedback would be
> appreciated!
> 

You are correct, the code in adm9240_fan_read() should acquire
the mutex before calling adm9240_write_fan_div() and while
manipulating data->fan_div[channel].

Guenter

  reply	other threads:[~2022-09-22  3:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 23:31 [BUG] drivers: adm9240: possible data race bug in adm9240_fan_read() Li Zhong
2022-09-22  3:16 ` Guenter Roeck [this message]
2022-09-22 20:37   ` Li Zhong
2022-09-22 21:53     ` Guenter Roeck
2022-09-22 23:46       ` Li Zhong

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=99ea1416-46dc-9712-271a-9e3daaa43e05@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=floridsleeves@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.