Re: [PATCH] fix for /dev/full

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Wed, 10 Sep 1997 10:45:07 +0200 (MET DST)


Wolfram Kleff wrote:
>
>
> 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 ?

No problems left. Comment: it saves code just to do the same as read_zero.
Either do a
return -EINVAL;
or make the read_full pointer point to read_null or read_zero.

Roger.

>
> --- 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;
> }
>
>

-- 
** R.E.Wolff@BitWizard.nl ** +31-15-2137555 ** http://www.BitWizard.nl/ **
Florida -- A 39 year old construction worker woke up this morning when a
109-car freigt train drove over him. According to the police the man was 
drunk. The man himself claims he slipped while walking the dog. 080897