pcmcia: avoid late calls to pccard_validate_cis

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, April 20, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/a8408c17d0038b76a83affb1b56dc18fa1e7ed86
Commit:     a8408c17d0038b76a83affb1b56dc18fa1e7ed86
Parent:     41b97ab5050088cd23692d578e7294c7be26109a
Author:     Dominik Brodowski <linux@dominikbrodowski.net>
AuthorDate: Sat Apr 17 17:37:33 2010 +0200
Committer:  Dominik Brodowski <linux@dominikbrodowski.net>
CommitDate: Sat Apr 17 17:37:33 2010 +0200

    pcmcia: avoid late calls to pccard_validate_cis
    
    pccard_validate_cis() nowadays destroys the CIS cache. Therefore,
    calling it after card setup should be avoided. We can't control
    the deprecated PCMCIA ioctl (which is only used on ARM nowadays),
    but we can avoid -- and report -- any other calls.
    
    Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 drivers/pcmcia/cistpl.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index f230f65..854959c 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1484,6 +1484,11 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
 	if (!s)
 		return -EINVAL;
 
+	if (s->functions) {
+		WARN_ON(1);
+		return -EINVAL;
+	}
+
 	/* We do not want to validate the CIS cache... */
 	mutex_lock(&s->ops_mutex);
 	destroy_cis_cache(s);
@@ -1639,7 +1644,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
 		count = 0;
 	else {
 		struct pcmcia_socket *s;
-		unsigned int chains;
+		unsigned int chains = 1;
 
 		if (off + count > size)
 			count = size - off;
@@ -1648,7 +1653,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
 
 		if (!(s->state & SOCKET_PRESENT))
 			return -ENODEV;
-		if (pccard_validate_cis(s, &chains))
+		if (!s->functions && pccard_validate_cis(s, &chains))
 			return -EIO;
 		if (!chains)
 			return -ENODATA;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
pcmcia: avoid late calls to pccard_validate_cis, Linux Kernel Mailing ..., (Tue Apr 20, 9:59 am)