netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: fix panic if initialization fails
@ 2009-05-08 21:49 Florian Westphal
  2009-05-08 22:10 ` Jay Vosburgh
  2009-05-08 23:21 ` Jiri Pirko
  0 siblings, 2 replies; 6+ messages in thread
From: Florian Westphal @ 2009-05-08 21:49 UTC (permalink / raw)
  To: bonding-devel; +Cc: netdev, Florian Westphal

If module initialisation failed (e.g. because the bonding sysfs entry
cannot be created), kernel panics:
 IP: [<ffffffff8024910a>] destroy_workqueue+0x2d/0x146
Call Trace:
 [<ffffffff808268c4>] bond_destructor+0x28/0x78
 [<ffffffff80b64471>] netdev_run_todo+0x231/0x25a
 [<ffffffff80b6dbcd>] rtnl_unlock+0x9/0xb
 [<ffffffff81567907>] bonding_init+0x83e/0x84a

Remove the calls to bond_work_cancel_all() and destroy_workqueue();
both are also called/scheduled via bond_free_all().

bond_destroy_sysfs is unecessary because the sysfs entry has
not been created in the error case.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 drivers/net/bonding/bond_main.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 815191d..56830a4 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5199,7 +5199,6 @@ static int __init bonding_init(void)
 {
 	int i;
 	int res;
-	struct bonding *bond;
 
 	printk(KERN_INFO "%s", version);
 
@@ -5228,13 +5227,6 @@ static int __init bonding_init(void)
 
 	goto out;
 err:
-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
-		bond_work_cancel_all(bond);
-		destroy_workqueue(bond->wq);
-	}
-
-	bond_destroy_sysfs();
-
 	rtnl_lock();
 	bond_free_all();
 	rtnl_unlock();
-- 
1.6.0.6


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

* Re: [PATCH] bonding: fix panic if initialization fails
  2009-05-08 21:49 [PATCH] bonding: fix panic if initialization fails Florian Westphal
@ 2009-05-08 22:10 ` Jay Vosburgh
  2009-05-08 23:21 ` Jiri Pirko
  1 sibling, 0 replies; 6+ messages in thread
From: Jay Vosburgh @ 2009-05-08 22:10 UTC (permalink / raw)
  To: Florian Westphal; +Cc: bonding-devel, netdev, David S. Miller

Florian Westphal <fw@strlen.de> wrote:

>If module initialisation failed (e.g. because the bonding sysfs entry
>cannot be created), kernel panics:
> IP: [<ffffffff8024910a>] destroy_workqueue+0x2d/0x146
>Call Trace:
> [<ffffffff808268c4>] bond_destructor+0x28/0x78
> [<ffffffff80b64471>] netdev_run_todo+0x231/0x25a
> [<ffffffff80b6dbcd>] rtnl_unlock+0x9/0xb
> [<ffffffff81567907>] bonding_init+0x83e/0x84a
>
>Remove the calls to bond_work_cancel_all() and destroy_workqueue();
>both are also called/scheduled via bond_free_all().
>
>bond_destroy_sysfs is unecessary because the sysfs entry has
>not been created in the error case.
>
>Signed-off-by: Florian Westphal <fw@strlen.de>

	Looks good to me.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

	-J


> drivers/net/bonding/bond_main.c |    8 --------
> 1 files changed, 0 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 815191d..56830a4 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -5199,7 +5199,6 @@ static int __init bonding_init(void)
> {
> 	int i;
> 	int res;
>-	struct bonding *bond;
>
> 	printk(KERN_INFO "%s", version);
>
>@@ -5228,13 +5227,6 @@ static int __init bonding_init(void)
>
> 	goto out;
> err:
>-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
>-		bond_work_cancel_all(bond);
>-		destroy_workqueue(bond->wq);
>-	}
>-
>-	bond_destroy_sysfs();
>-
> 	rtnl_lock();
> 	bond_free_all();
> 	rtnl_unlock();
>-- 
>1.6.0.6

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

* Re: [PATCH] bonding: fix panic if initialization fails
  2009-05-08 21:49 [PATCH] bonding: fix panic if initialization fails Florian Westphal
  2009-05-08 22:10 ` Jay Vosburgh
@ 2009-05-08 23:21 ` Jiri Pirko
  2009-05-08 23:30   ` Florian Westphal
  1 sibling, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2009-05-08 23:21 UTC (permalink / raw)
  To: Florian Westphal; +Cc: bonding-devel, netdev

Fri, May 08, 2009 at 11:49:11PM CEST, fw@strlen.de wrote:
>If module initialisation failed (e.g. because the bonding sysfs entry
>cannot be created), kernel panics:
> IP: [<ffffffff8024910a>] destroy_workqueue+0x2d/0x146
>Call Trace:
> [<ffffffff808268c4>] bond_destructor+0x28/0x78
> [<ffffffff80b64471>] netdev_run_todo+0x231/0x25a
> [<ffffffff80b6dbcd>] rtnl_unlock+0x9/0xb
> [<ffffffff81567907>] bonding_init+0x83e/0x84a
>
>Remove the calls to bond_work_cancel_all() and destroy_workqueue();
>both are also called/scheduled via bond_free_all().
>
>bond_destroy_sysfs is unecessary because the sysfs entry has
>not been created in the error case.
>
>Signed-off-by: Florian Westphal <fw@strlen.de>
>---
> drivers/net/bonding/bond_main.c |    8 --------
> 1 files changed, 0 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 815191d..56830a4 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -5199,7 +5199,6 @@ static int __init bonding_init(void)
> {
> 	int i;
> 	int res;
>-	struct bonding *bond;
> 
> 	printk(KERN_INFO "%s", version);
> 
>@@ -5228,13 +5227,6 @@ static int __init bonding_init(void)
> 
> 	goto out;
> err:
>-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
>-		bond_work_cancel_all(bond);
>-		destroy_workqueue(bond->wq);
>-	}
This looks correct.

>-
>-	bond_destroy_sysfs();
Why this is not here anymore? I think it should be called in this function.
>-
> 	rtnl_lock();
> 	bond_free_all();
> 	rtnl_unlock();
>-- 
>1.6.0.6
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] bonding: fix panic if initialization fails
  2009-05-08 23:21 ` Jiri Pirko
@ 2009-05-08 23:30   ` Florian Westphal
  2009-05-08 23:36     ` Jiri Pirko
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Westphal @ 2009-05-08 23:30 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Florian Westphal, bonding-devel, netdev

Jiri Pirko <jpirko@redhat.com> wrote:
> > err:
> >-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
> >-		bond_work_cancel_all(bond);
> >-		destroy_workqueue(bond->wq);
> >-	}
> This looks correct.
> 
> >-
> >-	bond_destroy_sysfs();
> Why this is not here anymore? I think it should be called in this function.

Thanks for reviewing.
I removed it because, if you hit this error path, sysfs registration
failed, so there is no entry to remove.

Its not a bug to call it though
(sysfs_hash_and_remove() returns -ENOENT in that case), and i can
re-spin without that change if you want.

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

* Re: [PATCH] bonding: fix panic if initialization fails
  2009-05-08 23:30   ` Florian Westphal
@ 2009-05-08 23:36     ` Jiri Pirko
  2009-05-09 20:20       ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2009-05-08 23:36 UTC (permalink / raw)
  To: Florian Westphal; +Cc: bonding-devel, netdev

Sat, May 09, 2009 at 01:30:57AM CEST, fw@strlen.de wrote:
>Jiri Pirko <jpirko@redhat.com> wrote:
>> > err:
>> >-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
>> >-		bond_work_cancel_all(bond);
>> >-		destroy_workqueue(bond->wq);
>> >-	}
>> This looks correct.
>> 
>> >-
>> >-	bond_destroy_sysfs();
>> Why this is not here anymore? I think it should be called in this function.
>
>Thanks for reviewing.
>I removed it because, if you hit this error path, sysfs registration
>failed, so there is no entry to remove.

Yes, you are rigth.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>

>
>Its not a bug to call it though
>(sysfs_hash_and_remove() returns -ENOENT in that case), and i can
>re-spin without that change if you want.
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] bonding: fix panic if initialization fails
  2009-05-08 23:36     ` Jiri Pirko
@ 2009-05-09 20:20       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-09 20:20 UTC (permalink / raw)
  To: jpirko; +Cc: fw, bonding-devel, netdev

From: Jiri Pirko <jpirko@redhat.com>
Date: Sat, 9 May 2009 01:36:04 +0200

> Sat, May 09, 2009 at 01:30:57AM CEST, fw@strlen.de wrote:
>>Jiri Pirko <jpirko@redhat.com> wrote:
>>> > err:
>>> >-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
>>> >-		bond_work_cancel_all(bond);
>>> >-		destroy_workqueue(bond->wq);
>>> >-	}
>>> This looks correct.
>>> 
>>> >-
>>> >-	bond_destroy_sysfs();
>>> Why this is not here anymore? I think it should be called in this function.
>>
>>Thanks for reviewing.
>>I removed it because, if you hit this error path, sysfs registration
>>failed, so there is no entry to remove.
> 
> Yes, you are right.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Applied, thanks!

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

end of thread, other threads:[~2009-05-09 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-08 21:49 [PATCH] bonding: fix panic if initialization fails Florian Westphal
2009-05-08 22:10 ` Jay Vosburgh
2009-05-08 23:21 ` Jiri Pirko
2009-05-08 23:30   ` Florian Westphal
2009-05-08 23:36     ` Jiri Pirko
2009-05-09 20:20       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).