Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c7308c81a8220ab68eebfadde37db881a2800064
Commit:     c7308c81a8220ab68eebfadde37db881a2800064
Parent:     dc87c3985e9b442c60994308a96f887579addc39
Author:     Greg Kroah-Hartman <[EMAIL PROTECTED]>
AuthorDate: Wed May 2 14:14:11 2007 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed May 2 18:57:59 2007 -0700

    Driver core: fix show_uevent from taking up way too much stack
    
    Declaring an array of PAGE_SIZE does bad things for people running with
    4k stacks...
    
    Thanks to Tilman Schmidt for tracking this down.
    
    Cc: Tilman Schmidt <[EMAIL PROTECTED]>
    Cc: Kay Sievers <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/base/core.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8aa090d..59d9816 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -252,7 +252,7 @@ static ssize_t show_uevent(struct device *dev, struct 
device_attribute *attr,
        struct kobject *top_kobj;
        struct kset *kset;
        char *envp[32];
-       char data[PAGE_SIZE];
+       char *data = NULL;
        char *pos;
        int i;
        size_t count = 0;
@@ -276,6 +276,10 @@ static ssize_t show_uevent(struct device *dev, struct 
device_attribute *attr,
                if (!kset->uevent_ops->filter(kset, &dev->kobj))
                        goto out;
 
+       data = (char *)get_zeroed_page(GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
        /* let the kset specific function add its keys */
        pos = data;
        retval = kset->uevent_ops->uevent(kset, &dev->kobj,
@@ -290,6 +294,7 @@ static ssize_t show_uevent(struct device *dev, struct 
device_attribute *attr,
                count += sprintf(pos, "%s\n", envp[i]);
        }
 out:
+       free_page((unsigned long)data);
        return count;
 }
 
-
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