From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
kernelnewbies@kernelnewbies.org
Subject: Re: [PATCH] staging: pi433: add mutex fixing race condition when accessing tx_cfg
Date: Tue, 12 Jun 2018 14:02:30 +0300 [thread overview]
Message-ID: <20180612110230.dvqmcyisdwaynixj@mwanda> (raw)
In-Reply-To: <20180612011200.GB1794@hle-laptop.local>
On Mon, Jun 11, 2018 at 09:12:00PM -0400, Hugo Lefeuvre wrote:
> In the PI433_IOC_WR_TX_CFG case in pi433_ioctl, instance->tx_cfg is
> modified using
>
> copy_from_user(&instance->tx_cfg, argp, sizeof(struct pi433_tx_cfg)))
>
> without any kind of synchronization. In the case where two threads
> would execute this same command concurrently the tx_cfg field might
> enter in an inconsistent state.
>
> Add a mutex making sure that the PI433_IOC_WR_TX_CFG case will never
> be run by several threads concurrently.
>
> Signed-off-by: Hugo Lefeuvre <hle@owl.eu.com>
We read the data from the user here and then we write it to the fifo
in pi433_write(). We should be using the device->tx_fifo_lock so that
we don't copy over the data at the same time we're writing it to the
fifo.
This bug could cause a user space program to fail.
regards,
dan carpenter
next prev parent reply other threads:[~2018-06-12 11:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 1:12 Hugo Lefeuvre
2018-06-12 11:02 ` Dan Carpenter [this message]
2018-06-13 0:36 ` Hugo Lefeuvre
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=20180612110230.dvqmcyisdwaynixj@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hle@owl.eu.com \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®