[PATCH] fix for /dev/full

Wolfram Kleff (kleff@informatik.uni-bonn.de)
Tue, 9 Sep 1997 19:46:09 +0200 (MET DST)


OK, /dev/full take 3 ;-)

There is still a problem with mode 622,
in really bad cases, the superuser can be fooled with /dev/full.

I have included the following patch, which should fix ALL problems.
(Really paranoid) people might change /dev/full to 622, but
I think that 666 should work save and fine, too.

Any problems left, any comments ?

--- mem.c~ Wed May 21 13:23:21 1997
+++ mem.c Tue Sep 9 19:22:56 1997
@@ -196,6 +196,17 @@

static int read_full(struct inode * node, struct file * file, char * buf,int count)
{
+ int left;
+
+ if (current->euid == 0) {
+ for (left = count; left > 0; left--) {
+ put_user(0,buf);
+ buf++;
+ if (need_resched)
+ schedule();
+ }
+ }
+
file->f_pos += count;
return count;
}