From: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
To: Satyam Sharma <satyam.sharma@gmail.com>
Cc: Jiri Slaby <jirislaby@gmail.com>,
Simon Arlott <simon@fire.lp0.eu>,
Arjan van de Ven <arjan@infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] fix unchecked mutex_lock_interruptible (was Re: use mutex instead of semaphore in RocketPort driver)
Date: Wed, 23 May 2007 15:59:11 +0200 [thread overview]
Message-ID: <20070523135911.GC31790@traven> (raw)
In-Reply-To: <a781481a0705230555j6fcf46eav43cc95f6d1a7ae6f@mail.gmail.com>
El Wed, May 23, 2007 at 06:25:49PM +0530 Satyam Sharma ha dit:
> On 5/23/07, Jiri Slaby <jirislaby@gmail.com> wrote:
> >Simon Arlott napsal(a):
> >> On 22/05/07 21:06, Matthias Kaehlcke wrote:
> >>> would the following resolve the problem?
> >>>
> >>> if(mutex_lock_interruptible(&info->write_mtx)) return
> >>> -ERESTARTSYS
> >>>
> >>> thanks for your comments
>
> Hum. I remember suggesting the fix when this came few weeks back,
> somehow the older version seems to have made it into Linus' tree.
i also remembered your suggestion but thought it was a similar case in
another driver. i think it's my fault that the older version made it
into the Linus tree cause i sent the patch in a new thread instead of
responding to the initial post :(
> >> No. At least one user of tty_operations/tty_driver's write function
> >> doesn't check the return value so it would never be retried, mutex_lock
> >> should be used instead.
>
> Replacing mutex_lock_interruptible() with a mutex_lock() could be a
> change in behaviour visible to userspace. Best to continue to use
> _interruptible. Returning EINTR would be safe choice because if
> Simon's right that this isn't retried, we could end up breaking
> userspace that isn't quite ready to see ERESTARTSYS coming out of
> a write(2), but ...
thanks for your fix!
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
The yellow ships hung in the air just like bricks dont do
(The Hitch-Hiker's Guide to the Galaxy)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
prev parent reply other threads:[~2007-05-23 13:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-23 12:55 [PATCH] fix unchecked mutex_lock_interruptible (was Re: use mutex instead of semaphore in RocketPort driver) Satyam Sharma
2007-05-23 13:59 ` Matthias Kaehlcke [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=20070523135911.GC31790@traven \
--to=matthias.kaehlcke@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=satyam.sharma@gmail.com \
--cc=simon@fire.lp0.eu \
/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