All of lore.kernel.org
 help / color / mirror / Atom feed
From: chetannanda@gmail.com (Chetan Nanda)
To: kernelnewbies@lists.kernelnewbies.org
Subject: owner not checked in mutex_unlock
Date: Thu, 10 Mar 2016 14:59:31 +0530	[thread overview]
Message-ID: <CAPrYoTGO8DaT=sbEbix1He-aBztCfmO6SuiBCnzYvTsr71D8-Q@mail.gmail.com> (raw)

Hi,

As per book (Linux kernel development)

"Whoever locked a mutex must unlock it.That is, you cannot lock a mutex in one
context and then unlock it in another
"
but 'mutex_unlock' code is not checking the owner field at all.

Also, I tried with locking the mutex from normal process context and
unlocking from separate context (work context) and it is allowed
without any error from kernel.

Is it the mutex user responsibility to keep track of it? Ideally
mutex_unlock should check if owner is same as current?

Thanks,
Chetan Nanda

             reply	other threads:[~2016-03-10  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10  9:29 Chetan Nanda [this message]
2016-03-15 13:48 ` owner not checked in mutex_unlock Cihangir Akturk
2016-03-15 13:59   ` Chetan Nanda
2016-03-15 14:42     ` Cihangir Akturk

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='CAPrYoTGO8DaT=sbEbix1He-aBztCfmO6SuiBCnzYvTsr71D8-Q@mail.gmail.com' \
    --to=chetannanda@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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 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.