diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-30 14:11:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-30 14:11:12 -0800 |
commit | bcdddfb66cc998252d34758ce4109cedc0d24a5c (patch) | |
tree | 8cea3d0275dce00f12b8b4ac853fac6841a1c6b9 | |
parent | 0f2452855d86901ba3766826ccb5606ea4e15ab9 (diff) | |
download | linux-stable-bcdddfb66cc998252d34758ce4109cedc0d24a5c.tar.gz linux-stable-bcdddfb66cc998252d34758ce4109cedc0d24a5c.tar.bz2 linux-stable-bcdddfb66cc998252d34758ce4109cedc0d24a5c.zip |
Revert "net: ifb error path loop fix"
This reverts commit 0c0b3ae68ec93b1db5c637d294647d1cca0df763.
Quoth David:
"Jeff, please revert
It's wrong. We had a lengthy analysis of this piece of code
several months ago, and it is correct.
Consider, if we run the loop and we get an error
the following happens:
1) attempt of ifb_init_one(i) fails, therefore we should
not try to "ifb_free_one()" on "i" since it failed
2) the loop iteration first increments "i", then it
check for error
Therefore we must decrement "i" twice before the first
free during the cleanup. One to "undo" the for() loop
increment, and one to "skip" the ifb_init_one() case which
failed."
Reported-by: David Miller <davem@davemloft.net>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Cc: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/net/ifb.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index c4ca7c930a46..ca2b21f9d444 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -271,7 +271,8 @@ static int __init ifb_init_module(void) for (i = 0; i < numifbs && !err; i++) err = ifb_init_one(i); if (err) { - while (i--) + i--; + while (--i >= 0) ifb_free_one(i); } |