The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segoon@openwall.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Patrick Boettcher <patrick.boettcher@dibcom.fr>,
	Olivier Grenie <olivier.grenie@dibcom.fr>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] media: dvb: dib9000: buggy locking
Date: Wed, 19 Jan 2011 16:10:10 +0300	[thread overview]
Message-ID: <20110119131010.GA10321@albatros> (raw)

Hi,

I've noticed that locking in drivers/media/dvb/frontends/dib9000.c is
not correct:

static int dib9000_fw_get_channel(...)
{
    ...
	DibAcquireLock(&state->platform.risc.mem_mbx_lock);
    ...

error:
	DibReleaseLock(&state->platform.risc.mem_mbx_lock);
	return ret;
}

#define DibAcquireLock(lock) do { if (mutex_lock_interruptible(lock) < 0) dprintk("could not get the lock"); } while (0)
#define DibReleaseLock(lock) mutex_unlock(lock)


1) If mutex is not hold, then the critical section is not protected.

2) If mutex was not hold, then the code tries to release not holded
mutex.


This locking "style" is used all over the driver.


Thanks,

-- 
Vasiliy Kulikov
http://www.openwall.com - bringing security into open computing environments

                 reply	other threads:[~2011-01-19 13:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110119131010.GA10321@albatros \
    --to=segoon@openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=olivier.grenie@dibcom.fr \
    --cc=patrick.boettcher@dibcom.fr \
    /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