aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-05-02 08:14:11 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-05-02 21:57:59 -0400
commitc7308c81a8220ab68eebfadde37db881a2800064 (patch)
tree3858df7cc85b4bf84c8c1dc2157c425286c2c386 /drivers/base
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
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 <tilman@imap.cc> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8aa090da1cd7..59d9816c332e 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,
252 struct kobject *top_kobj; 252 struct kobject *top_kobj;
253 struct kset *kset; 253 struct kset *kset;
254 char *envp[32]; 254 char *envp[32];
255 char data[PAGE_SIZE]; 255 char *data = NULL;
256 char *pos; 256 char *pos;
257 int i; 257 int i;
258 size_t count = 0; 258 size_t count = 0;
@@ -276,6 +276,10 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
276 if (!kset->uevent_ops->filter(kset, &dev->kobj)) 276 if (!kset->uevent_ops->filter(kset, &dev->kobj))
277 goto out; 277 goto out;
278 278
279 data = (char *)get_zeroed_page(GFP_KERNEL);
280 if (!data)
281 return -ENOMEM;
282
279 /* let the kset specific function add its keys */ 283 /* let the kset specific function add its keys */
280 pos = data; 284 pos = data;
281 retval = kset->uevent_ops->uevent(kset, &dev->kobj, 285 retval = kset->uevent_ops->uevent(kset, &dev->kobj,
@@ -290,6 +294,7 @@ static ssize_t show_uevent(struct device *dev, struct device_attribute *attr,
290 count += sprintf(pos, "%s\n", envp[i]); 294 count += sprintf(pos, "%s\n", envp[i]);
291 } 295 }
292out: 296out:
297 free_page((unsigned long)data);
293 return count; 298 return count;
294} 299}
295 300