Skip to contentSkip to conversation

pcmcia: rsrc_nonstatic: fix invalid iounmap warning on card insertion

PATCH New Luc Bertho 1 participant 1 message Nov 4 Pcmcia

lore
Share & tools
lore

Luc Bertho

author
#0 lore raw

PATCH 1/1 pcmcia: rsrc_nonstatic: fix invalid iounmap warning on card insertion

When inserting a CompactFlash card via a PCMCIA adapter on a Dell Latitude, the pccardd daemon triggers a WARNING in iounmap() on recent kernels (>= 6.12) because it attempts to unmap an address that may have already been released or tracking context has shifted.

Fix this by explicitly checking if s->cis_virt is valid before invoking iounmap().

---

drivers/pcmcia/rsrc_nonstatic.c +4 -2
@@ -279,8 +279,10 @@
 			ret = s->callback->validate(s, count);
 		/* invalidate mapping */
 		mutex_lock(&s->ops_mutex);
-		iounmap(s->cis_virt);
-		s->cis_virt = NULL;
+		if (s->cis_virt) {
+			iounmap(s->cis_virt);
+			s->cis_virt = NULL;
+		}
 	}
 	s->cis_mem.res = NULL;
 	if ((ret) || (*count == 0))