All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 11:15 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-03-06 11:15 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: David S. Miller, Dave Young, Greg Kroah-Hartman, Roger Quadros,
	Bing Zhao, linux-bluetooth, netdev, kernel-janitors

The original code would break with a 4K stack.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This was compile tested only.  Sorry about that.

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 1a79a6c..835758f 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
 	struct hci_dev *hdev = file->private_data;
 	struct inquiry_cache *cache = &hdev->inq_cache;
 	struct inquiry_entry *e;
-	char buf[4096];
+	char *buf;
 	int n = 0;
+	ssize_t ret;
 
+	buf = kmalloc(4096, GFP_KERNEL);
 	hci_dev_lock_bh(hdev);
 
 	for (e = cache->list; e; e = e->next) {
@@ -437,7 +439,10 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
 
 	hci_dev_unlock_bh(hdev);
 
-	return simple_read_from_buffer(userbuf, count, ppos, buf, n);
+	ret = simple_read_from_buffer(userbuf, count, ppos, buf, n);
+	kfree(buf);
+
+	return ret;
 }
 
 static const struct file_operations inquiry_cache_fops = {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 11:15 ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-03-06 11:15 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: David S. Miller, Dave Young, Greg Kroah-Hartman, Roger Quadros,
	Bing Zhao, linux-bluetooth, netdev, kernel-janitors

The original code would break with a 4K stack.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This was compile tested only.  Sorry about that.

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 1a79a6c..835758f 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
 	struct hci_dev *hdev = file->private_data;
 	struct inquiry_cache *cache = &hdev->inq_cache;
 	struct inquiry_entry *e;
-	char buf[4096];
+	char *buf;
 	int n = 0;
+	ssize_t ret;
 
+	buf = kmalloc(4096, GFP_KERNEL);
 	hci_dev_lock_bh(hdev);
 
 	for (e = cache->list; e; e = e->next) {
@@ -437,7 +439,10 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
 
 	hci_dev_unlock_bh(hdev);
 
-	return simple_read_from_buffer(userbuf, count, ppos, buf, n);
+	ret = simple_read_from_buffer(userbuf, count, ppos, buf, n);
+	kfree(buf);
+
+	return ret;
 }
 
 static const struct file_operations inquiry_cache_fops = {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
  2010-03-06 11:15 ` Dan Carpenter
@ 2010-03-06 14:40   ` Jan Ceuleers
  -1 siblings, 0 replies; 9+ messages in thread
From: Jan Ceuleers @ 2010-03-06 14:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Marcel Holtmann, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

Dan Carpenter wrote:

Error handling?

> The original code would break with a 4K stack.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> This was compile tested only.  Sorry about that.
> 
> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> index 1a79a6c..835758f 100644
> --- a/net/bluetooth/hci_sysfs.c
> +++ b/net/bluetooth/hci_sysfs.c
> @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
>  	struct hci_dev *hdev = file->private_data;
>  	struct inquiry_cache *cache = &hdev->inq_cache;
>  	struct inquiry_entry *e;
> -	char buf[4096];
> +	char *buf;
>  	int n = 0;
> +	ssize_t ret;
>  
> +	buf = kmalloc(4096, GFP_KERNEL);

Could this kmalloc not fail?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 14:40   ` Jan Ceuleers
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Ceuleers @ 2010-03-06 14:40 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Marcel Holtmann, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

Dan Carpenter wrote:

Error handling?

> The original code would break with a 4K stack.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> This was compile tested only.  Sorry about that.
> 
> diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> index 1a79a6c..835758f 100644
> --- a/net/bluetooth/hci_sysfs.c
> +++ b/net/bluetooth/hci_sysfs.c
> @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
>  	struct hci_dev *hdev = file->private_data;
>  	struct inquiry_cache *cache = &hdev->inq_cache;
>  	struct inquiry_entry *e;
> -	char buf[4096];
> +	char *buf;
>  	int n = 0;
> +	ssize_t ret;
>  
> +	buf = kmalloc(4096, GFP_KERNEL);

Could this kmalloc not fail?



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
  2010-03-06 14:40   ` Jan Ceuleers
  (?)
@ 2010-03-06 15:30       ` Dan Carpenter
  -1 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-03-06 15:30 UTC (permalink / raw)
  To: Jan Ceuleers
  Cc: Marcel Holtmann, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Sat, Mar 06, 2010 at 03:40:31PM +0100, Jan Ceuleers wrote:
> Dan Carpenter wrote:
> 
> Error handling?
> 
> > The original code would break with a 4K stack.
> > 
> > Signed-off-by: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > ---
> > This was compile tested only.  Sorry about that.
> > 
> > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > index 1a79a6c..835758f 100644
> > --- a/net/bluetooth/hci_sysfs.c
> > +++ b/net/bluetooth/hci_sysfs.c
> > @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
> >  	struct hci_dev *hdev = file->private_data;
> >  	struct inquiry_cache *cache = &hdev->inq_cache;
> >  	struct inquiry_entry *e;
> > -	char buf[4096];
> > +	char *buf;
> >  	int n = 0;
> > +	ssize_t ret;
> >  
> > +	buf = kmalloc(4096, GFP_KERNEL);
> 
> Could this kmalloc not fail?

Grr...  I'm really sorry about that.

I will send an updated patch tomorrow.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 15:30       ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-03-06 15:30 UTC (permalink / raw)
  To: Jan Ceuleers
  Cc: Marcel Holtmann, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

On Sat, Mar 06, 2010 at 03:40:31PM +0100, Jan Ceuleers wrote:
> Dan Carpenter wrote:
> 
> Error handling?
> 
> > The original code would break with a 4K stack.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > ---
> > This was compile tested only.  Sorry about that.
> > 
> > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > index 1a79a6c..835758f 100644
> > --- a/net/bluetooth/hci_sysfs.c
> > +++ b/net/bluetooth/hci_sysfs.c
> > @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
> >  	struct hci_dev *hdev = file->private_data;
> >  	struct inquiry_cache *cache = &hdev->inq_cache;
> >  	struct inquiry_entry *e;
> > -	char buf[4096];
> > +	char *buf;
> >  	int n = 0;
> > +	ssize_t ret;
> >  
> > +	buf = kmalloc(4096, GFP_KERNEL);
> 
> Could this kmalloc not fail?

Grr...  I'm really sorry about that.

I will send an updated patch tomorrow.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 15:30       ` Dan Carpenter
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Carpenter @ 2010-03-06 15:30 UTC (permalink / raw)
  To: Jan Ceuleers
  Cc: Marcel Holtmann, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

On Sat, Mar 06, 2010 at 03:40:31PM +0100, Jan Ceuleers wrote:
> Dan Carpenter wrote:
> 
> Error handling?
> 
> > The original code would break with a 4K stack.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > ---
> > This was compile tested only.  Sorry about that.
> > 
> > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > index 1a79a6c..835758f 100644
> > --- a/net/bluetooth/hci_sysfs.c
> > +++ b/net/bluetooth/hci_sysfs.c
> > @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
> >  	struct hci_dev *hdev = file->private_data;
> >  	struct inquiry_cache *cache = &hdev->inq_cache;
> >  	struct inquiry_entry *e;
> > -	char buf[4096];
> > +	char *buf;
> >  	int n = 0;
> > +	ssize_t ret;
> >  
> > +	buf = kmalloc(4096, GFP_KERNEL);
> 
> Could this kmalloc not fail?

Grr...  I'm really sorry about that.

I will send an updated patch tomorrow.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
  2010-03-06 15:30       ` Dan Carpenter
@ 2010-03-06 17:49         ` Marcel Holtmann
  -1 siblings, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2010-03-06 17:49 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jan Ceuleers, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

Hi Dan,

> > Error handling?
> > 
> > > The original code would break with a 4K stack.
> > > 
> > > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > > ---
> > > This was compile tested only.  Sorry about that.
> > > 
> > > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > > index 1a79a6c..835758f 100644
> > > --- a/net/bluetooth/hci_sysfs.c
> > > +++ b/net/bluetooth/hci_sysfs.c
> > > @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
> > >  	struct hci_dev *hdev = file->private_data;
> > >  	struct inquiry_cache *cache = &hdev->inq_cache;
> > >  	struct inquiry_entry *e;
> > > -	char buf[4096];
> > > +	char *buf;
> > >  	int n = 0;
> > > +	ssize_t ret;
> > >  
> > > +	buf = kmalloc(4096, GFP_KERNEL);
> > 
> > Could this kmalloc not fail?
> 
> Grr...  I'm really sorry about that.
> 
> I will send an updated patch tomorrow.

please don't since we fixed this already in the net-2.6 tree.

Regards

Marcel



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch] bluetooth: debugfs changes use too much stack
@ 2010-03-06 17:49         ` Marcel Holtmann
  0 siblings, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2010-03-06 17:49 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jan Ceuleers, David S. Miller, Dave Young, Greg Kroah-Hartman,
	Roger Quadros, Bing Zhao, linux-bluetooth, netdev,
	kernel-janitors

Hi Dan,

> > Error handling?
> > 
> > > The original code would break with a 4K stack.
> > > 
> > > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > > ---
> > > This was compile tested only.  Sorry about that.
> > > 
> > > diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> > > index 1a79a6c..835758f 100644
> > > --- a/net/bluetooth/hci_sysfs.c
> > > +++ b/net/bluetooth/hci_sysfs.c
> > > @@ -417,9 +417,11 @@ static ssize_t inquiry_cache_read(struct file *file, char __user *userbuf,
> > >  	struct hci_dev *hdev = file->private_data;
> > >  	struct inquiry_cache *cache = &hdev->inq_cache;
> > >  	struct inquiry_entry *e;
> > > -	char buf[4096];
> > > +	char *buf;
> > >  	int n = 0;
> > > +	ssize_t ret;
> > >  
> > > +	buf = kmalloc(4096, GFP_KERNEL);
> > 
> > Could this kmalloc not fail?
> 
> Grr...  I'm really sorry about that.
> 
> I will send an updated patch tomorrow.

please don't since we fixed this already in the net-2.6 tree.

Regards

Marcel



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-06 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-06 11:15 [patch] bluetooth: debugfs changes use too much stack Dan Carpenter
2010-03-06 11:15 ` Dan Carpenter
2010-03-06 14:40 ` Jan Ceuleers
2010-03-06 14:40   ` Jan Ceuleers
     [not found]   ` <4B92695F.60601-bdq14YP6qtRg9hUCZPvPmw@public.gmane.org>
2010-03-06 15:30     ` Dan Carpenter
2010-03-06 15:30       ` Dan Carpenter
2010-03-06 15:30       ` Dan Carpenter
2010-03-06 17:49       ` Marcel Holtmann
2010-03-06 17:49         ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.