[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200829074758.GA16838@amd>
Date: Sat, 29 Aug 2020 09:47:58 +0200
From: Pavel Machek <pavel@....cz>
To: Raul E Rangel <rrangel@...omium.org>
Cc: linux-input@...r.kernel.org, dmitry.torokhov@...il.com,
Shirish.S@....com, Andy Shevchenko <andy@...radead.org>,
Dan Murphy <dmurphy@...com>,
Darren Hart <dvhart@...radead.org>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
"Lee, Chun-Yi" <jlee@...e.com>, Rajat Jain <rajatja@...gle.com>,
Stephen Boyd <swboyd@...omium.org>,
linux-kernel@...r.kernel.org, linux-leds@...r.kernel.org,
platform-driver-x86@...r.kernel.org
Subject: Re: [PATCH 1/2] Input: i8042 - Prevent intermixing i8042 commands
On Thu 2020-08-27 13:52:22, Raul E Rangel wrote:
> The i8042_mutex must be held by writers of the AUX and KBD ports, as
> well as users of i8042_command. There were a lot of users of
> i8042_command that were not calling i8042_lock_chip/i8042_unlock_chip.
> This resulted in i8042_commands being issues in between PS/2
> transactions.
>
> This change moves the mutex lock into i8042_command and removes the
> burden of locking the mutex from the callers.
>
> It is expected that the i8042_mutex is locked before calling
> i8042_aux_write or i8042_kbd_write. This is currently done by the PS/2
> layer via ps2_begin_command and ps2_end_command. Other modules
> (serio_raw) do not currently lock the mutex, so there is still a
> possibility for intermixed commands.
> @@ -343,10 +330,14 @@ int i8042_command(unsigned char *param, int command)
> unsigned long flags;
> int retval;
>
> + mutex_lock(&i8042_mutex);
> +
> spin_lock_irqsave(&i8042_lock, flags);
> retval = __i8042_command(param, command);
> spin_unlock_irqrestore(&i8042_lock, flags);
>
> + mutex_unlock(&i8042_mutex);
> +
> return retval;
There's something wrong with whitespace here. Checkpatch?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists