From: Alan Cox <alan@linux.intel.com>
To: linux-kernel@vger.kernel.org, linux-pcmica@lists.infradead.org
Subject: [PATCH 3/5] pcmcia: Fix requery
Date: Thu, 04 Dec 2014 21:30:00 +0000 [thread overview]
Message-ID: <20141204212933.1351.53861.stgit@localhost.localdomain> (raw)
In-Reply-To: <20141204212746.1351.89165.stgit@localhost.localdomain>
The requery logic goes off and attempts to read the CIS of empty slots. In
most cases this happens not to do any harm - but not all!
Add the missing check and also a WARN() to catch any other offenders.
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/pcmcia/cistpl.c | 2 +-
drivers/pcmcia/ds.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 4ff725c..8b3b492 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1386,7 +1386,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
if (!s)
return -EINVAL;
- if (s->functions) {
+ if (s->functions || !(s->state & SOCKET_PRESENT)) {
WARN_ON(1);
return -EINVAL;
}
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 757119b..d3baf0b 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -667,6 +667,9 @@ static void pcmcia_requery(struct pcmcia_socket *s)
{
int has_pfc;
+ if (!(s->state & SOCKET_PRESENT))
+ return;
+
if (s->functions == 0) {
pcmcia_card_add(s);
return;
next prev parent reply other threads:[~2014-12-04 21:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 21:28 [PATCH 0/5] pcmcia: 64bit fixes, anonymous cards, other bugs Alan Cox
2014-12-04 21:28 ` [PATCH 1/5] pcmcia: correct types Alan Cox
2014-12-04 21:29 ` [PATCH 2/5] pcmcia cis: on an out of range CIS read return 0xff, don't just warn Alan Cox
2014-12-04 21:30 ` Alan Cox [this message]
2014-12-04 21:30 ` [PATCH 4/5] pcmcia: handle anonymous cards by generating a fake CIS Alan Cox
2015-06-14 19:52 ` Dominik Brodowski
2015-06-15 12:10 ` Alan Cox
2015-06-16 6:19 ` Dominik Brodowski
2014-12-04 21:31 ` [PATCH 5/5] pcmcia: add a new resource manager for non ISA systems Alan Cox
2015-05-30 14:40 ` Dominik Brodowski
2015-06-01 13:59 ` Alan Cox
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=20141204212933.1351.53861.stgit@localhost.localdomain \
--to=alan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pcmica@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox