Skip to content

Commit bcdddfb

Browse files
author
Linus Torvalds
committed
Revert "net: ifb error path loop fix"
This reverts commit 0c0b3ae. 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>
1 parent 0f24528 commit bcdddfb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎drivers/net/ifb.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ static int __init ifb_init_module(void)
271271
for (i = 0; i < numifbs && !err; i++)
272272
err = ifb_init_one(i);
273273
if (err) {
274-
while (i--)
274+
i--;
275+
while (--i >= 0)
275276
ifb_free_one(i);
276277
}
277278

0 commit comments

Comments
 (0)