فهرست منبع

pcmcia: Fix requery

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alan Cox 10 سال پیش
والد
کامیت
8402641b2d
2فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 1 1
      drivers/pcmcia/cistpl.c
  2. 3 0
      drivers/pcmcia/ds.c

+ 1 - 1
drivers/pcmcia/cistpl.c

@@ -1386,7 +1386,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
 	if (!s)
 	if (!s)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (s->functions) {
+	if (s->functions || !(s->state & SOCKET_PRESENT)) {
 		WARN_ON(1);
 		WARN_ON(1);
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}

+ 3 - 0
drivers/pcmcia/ds.c

@@ -667,6 +667,9 @@ static void pcmcia_requery(struct pcmcia_socket *s)
 {
 {
 	int has_pfc;
 	int has_pfc;
 
 
+	if (!(s->state & SOCKET_PRESENT))
+		return;
+
 	if (s->functions == 0) {
 	if (s->functions == 0) {
 		pcmcia_card_add(s);
 		pcmcia_card_add(s);
 		return;
 		return;