public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <wbg@kernel.org>
To: William Breathitt Gray <william.gray@linaro.org>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] counter: 104-quad-8: Fix race getting function mode and direction
Date: Sat, 22 Oct 2022 11:11:57 -0400	[thread overview]
Message-ID: <Y1QIPTIxjo9rDF/I@ishi> (raw)
In-Reply-To: <20221020141121.15434-1-william.gray@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

On Thu, Oct 20, 2022 at 10:11:21AM -0400, William Breathitt Gray wrote:
> The quad8_action_read() function checks the Count function mode and
> Count direction without first acquiring a lock. This is a race condition
> because the function mode could change by the time the direction is
> checked.
> 
> Because the quad8_function_read() already acquires a lock internally,
> the quad8_function_read() is refactored to spin out the no-lock code to
> a new quad8_function_get() function.
> 
> To resolve the race condition in quad8_action_read(), a lock is acquired
> before calling quad8_function_get() and quad8_direction_read() in order
> to get both function mode and direction atomically.
> 
> Fixes: f1d8a071d45b ("counter: 104-quad-8: Add Generic Counter interface support")
> Cc: stable@vger.kernel.org
> Signed-off-by: William Breathitt Gray <william.gray@linaro.org>

Queued for counter-fixes.

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2022-10-22 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 14:11 [PATCH] counter: 104-quad-8: Fix race getting function mode and direction William Breathitt Gray
2022-10-22 15:11 ` William Breathitt Gray [this message]

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=Y1QIPTIxjo9rDF/I@ishi \
    --to=wbg@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=william.gray@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox