Messages in this thread Patch in this message | | | Date | Fri, 11 Feb 2000 17:04:27 +0000 (GMT) | From | Tigran Aivazian <> | Subject | [patch-2.3.44-pre3] bugfix: read_kmem() should return -EFAULT (sometimes) |
| |
Hi Linus,
I noticed that read_kmem() (unlike read_mem()) doesn't return -EFAULT if clear_user()/copy_to_user() fail. This patch fixes it:
http://www.ocston.org/~tigran/patches/mem-2.3.44-p3.patch
The file is drivers/char/mem.c
Regards, ------ Tigran A. Aivazian | http://www.sco.com Escalations Research Group | tel: +44-(0)1923-813796 Santa Cruz Operation Ltd | http://www.ocston.org/~tigran
--- mem.c.0 Fri Feb 11 14:54:01 2000 +++ mem.c Fri Feb 11 14:54:37 2000 @@ -245,14 +245,16 @@ if (p < PAGE_SIZE && read > 0) { size_t tmp = PAGE_SIZE - p; if (tmp > read) tmp = read; - clear_user(buf, tmp); + if (clear_user(buf, tmp)) + return -EFAULT; buf += tmp; p += tmp; read -= tmp; count -= tmp; } #endif - copy_to_user(buf, (char *)p, read); + if (copy_to_user(buf, (char *)p, read)) + return -EFAULT; p += read; buf += read; count -= read;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |