Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=59f91ff11e594913a5b3c03a4707fdf02338c8df
Commit:     59f91ff11e594913a5b3c03a4707fdf02338c8df
Parent:     4273af8d08c823d5898a2b1c2d0f25b4a8b9eaee
Author:     Henrique de Moraes Holschuh <[EMAIL PROTECTED]>
AuthorDate: Sun Nov 18 09:18:29 2007 -0200
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Mon Nov 19 16:10:04 2007 -0500

    ACPI: thinkpad-acpi: fix oops when a module parameter has no value
    
    set_ibm_param() could OOPS with a NULL pointer derreference if one did not 
give
    any values for a module parameter it handles.  This would, of course, cause 
all
    sort of trouble for future modprobing and require a reboot to clean up
    properly.
    
    Fix it by returning -EINVAL if no values are given for the parameter, and 
also
    avoid any nastyness from BUG_ON while at it.
    
    How to reproduce: modprobe thinkpad-acpi brightness
    
    Signed-off-by: Henrique de Moraes Holschuh <[EMAIL PROTECTED]>
    Tested-by: Mike Kershaw <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 drivers/misc/thinkpad_acpi.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 8c94307..ab23a32 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -4817,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct 
kernel_param *kp)
        unsigned int i;
        struct ibm_struct *ibm;
 
+       if (!kp || !kp->name || !val)
+               return -EINVAL;
+
        for (i = 0; i < ARRAY_SIZE(ibms_init); i++) {
                ibm = ibms_init[i].data;
-               BUG_ON(ibm == NULL);
+               WARN_ON(ibm == NULL);
+
+               if (!ibm || !ibm->name)
+                       continue;
 
                if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
                        if (strlen(val) > sizeof(ibms_init[i].param) - 2)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to