From: Andrew Morton <akpm@linux-foundation.org>
To: "Markus Rechberger" <markus.rechberger@amd.com>
Cc: linux-kernel@vger.kernel.org,
Dominik Brodowski <linux@dominikbrodowski.net>
Subject: Re: [PATCH] pcmcia/pccard deadlock fix
Date: Sun, 25 Feb 2007 04:52:31 -0800 [thread overview]
Message-ID: <20070225045231.81682e06.akpm@linux-foundation.org> (raw)
In-Reply-To: <45DB0EDB.3090803@amd.com>
> On Tue, 20 Feb 2007 16:08:11 +0100 "Markus Rechberger" <markus.rechberger@amd.com> wrote:
> following patch prevents a mutex/semaphore deadlock within the pcmcia
> framework when ejecting devices multiple times using pccardctl eject.
>
> For some more details see:
> http://lkml.org/lkml/2007/2/19/58
>
> --- a/drivers/pcmcia/cs.c
> +++ b/drivers/pcmcia/cs.c
> @@ -856,7 +856,8 @@ int pcmcia_eject_card(struct pcmcia_socket *skt)
>
> cs_dbg(skt, 1, "user eject request\n");
>
> - mutex_lock(&skt->skt_mutex);
> + if (!mutex_trylock(&skt->skt_mutex))
> + return -EAGAIN;
> do {
> if (!(skt->state & SOCKET_PRESENT)) {
> ret = -ENODEV;
> index 18e111e..b9d3440 100644
> --- a/drivers/pcmcia/ds.c
> +++ b/drivers/pcmcia/ds.c
> @@ -1100,7 +1100,9 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
> if (!count)
> return -EINVAL;
>
> - mutex_lock(&p_dev->socket->skt_mutex);
> + if (!mutex_trylock(&p_dev->socket->skt_mutex))
> + return -EAGAIN;
> +
> p_dev->allow_func_id_match = 1;
> mutex_unlock(&p_dev->socket->skt_mutex);
That looks rather hacky. I'll queue it up to bug Dominik with, but
hopeully we'll come up with some fix which avoids the trylocks.
next prev parent reply other threads:[~2007-02-25 12:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 15:08 [PATCH] pcmcia/pccard deadlock fix Markus Rechberger
2007-02-25 12:52 ` Andrew Morton [this message]
2007-05-02 21:20 ` Andrew Morton
2007-05-03 9:46 ` Markus Rechberger
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=20070225045231.81682e06.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=markus.rechberger@amd.com \
/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