All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: iceberg <strakh@ispras.ru>, Vojtech Pavlik <vojtech@suse.cz>,
	Linux Kernlel Mailing List <linux-kernel@vger.kernel.org>,
	linux-input@vger.kernel.org
Subject: Re: [BUG] ati_remote2.c: possible mutex_lock without mutex_unlock
Date: Wed, 14 Oct 2009 09:11:06 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LSU.2.00.0910140906280.8582@wotan.suse.de> (raw)
In-Reply-To: <20091014062902.GA2971@core.coreip.homeip.net>

On Tue, 13 Oct 2009, Dmitry Torokhov wrote:

> Umm, I don't like assuming that EAGAIN can only mean that 
> mutex_lock_interruptible() failed, seq_file core may theoretically 
> return -EAGAIN too. In fact, looking through seq_file.c traverse() does 
> return -EAGAIN in certain cases...

Damn, you are right -- I explicitly checked for this, but have completely 
overlooked the "Eoveflow:" branch in traverse(), which returns EAGAIN. So 
my previous patch is of course incorrect.

> Input: fix locking issue in /proc/bus/input/ handlers
> 
> From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> input_devices_seq_start() uses mutex_lock_interruptible() to acquire
> the input_mutex, but doesn't properly handle the situation when the
> call fails (for example due to interrupt). Instead of returning NULL
> (which indicates that there is no more data) we should return
> ERR_PTR()-encoded error.
> 
> We also need explicit flag indicating whether input_mutex was acquired
> since input_devices_seq_stop() is called whether input_devices_seq_start()
> was successful or not.
> 
> The same applies to input_handlers_seq_start().
> 
> Reported-by: iceberg <strakh@ispras.ru>
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

Yup, looks OK to me.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

  reply	other threads:[~2009-10-14  7:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13 17:52 [BUG] ati_remote2.c: possible mutex_lock without mutex_unlock iceberg
2009-10-13 17:52 ` iceberg
2009-10-13 15:43 ` Jiri Kosina
2009-10-14  6:29   ` Dmitry Torokhov
2009-10-14  7:11     ` Jiri Kosina [this message]
2009-10-14  7:14       ` Dmitry Torokhov
2009-10-14  7:16         ` Jiri Kosina

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=alpine.LSU.2.00.0910140906280.8582@wotan.suse.de \
    --to=jkosina@suse.cz \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=strakh@ispras.ru \
    --cc=vojtech@suse.cz \
    /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.