[PATCH-2.4] range checking for sleep states sent to /proc/acpi/sleep



Hi,

A range checking is missing in acpi_system_write_sleep() in kernel
2.4, and writing a large integer value to /proc/acpi/sleep will cause
an oops. I could reproduce one this way :

# echo 0x800000 >/proc/acpi/sleep

Fix extracted from the PaX patch.

Cheers,
Willy

---

drivers/acpi/system.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

3cae76269fd00aa352255d872c8f461472ef8b56
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index a1e018c..26f7b68 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -748,7 +748,7 @@ acpi_system_write_sleep (

state = simple_strtoul(state_string, NULL, 0);

- if (!system->states[state])
+ if (state >= ACPI_S_STATE_COUNT || !system->states[state])
return_VALUE(-ENODEV);

/*
--
1.3.3

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: oops on 2.6.19-rc6-mm2: deref of 0x28 at permission+0x7
    ... the oops is fully reproducible. ... I think Neil is working on it. ... would either of both of you see if you can reproduce the bug with ... Monolithic as much as possible (md is in the kernel and so dm is). ...
    (Linux-Kernel)
  • Re: oops in 2.6.13-rc6-git5
    ... > Can you reproduce the crash with a non-tainted kernel? ... I've tried several times now to reproduce the oops, ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • 2.6.32-rc1: oops in vfs_getattr (sysfs, maybe?)
    ... While running find on /sys on 2.6.32-rc1, I got the oops below. ... haven't been able to reproduce it. ... BUG: unable to handle kernel NULL pointer dereference ...
    (Linux-Kernel)
  • Re: oops on 2.6.19-rc6-mm2: deref of 0x28 at permission+0x7
    ... the oops is fully reproducible. ... It is a bit of a long-shot, but this patch might change ... would either of both of you see if you can reproduce the bug with ... And you compile your own kernel. ...
    (Linux-Kernel)
  • Oops with "linux-2.4.29"
    ... Kernel "linux-2.4.29" oopses irregularly. ... We are running software RAID1 on two SCSI hard disks, ... I didn't have the time to write a bug report ... linux kernel 2.4.29 oops ext3 I/O high load SCSI ...
    (Linux-Kernel)