Skip to contentSkip to conversation

Patch for a leak of anonymous devices

PATCH Pete Zaitcev 1 participant 1 message Apr 9, 2002 VFS

lore
Share & tools
lore
#0 lore raw

Hi, Al:

Arjan used your fix from 2.5 which simply moves the allocation of the device. Are you going to change in in 2.4 too? Here's what I did for 2.4.18-pre6 temporarily:

fs/super.c +3 -0
@@ -632,6 +632,9 @@
 			continue;
 		if (!grab_super(old))
 			goto retry;
+		spin_lock(&unnamed_dev_lock);
+		clear_bit(dev, unnamed_dev_in_use);
+		spin_unlock(&unnamed_dev_lock);
 		destroy_super(s);
 		return old;
 	}

Another question: your code allows to allocate device (0,0). I assume you found it safe; everything works. However, why is it safe? Do we have no functions that return zero as a device number to indicate a failure?

My moremounts patch simple pre-sets the first bit of the unnamed_dev_in_use bitmap to avoid this. But perhaps I am paranoid here.

-- Pete