firewire: core: fix retries calculation in iso manage_channel()
authorClemens Ladisch <clemens@ladisch.de>
Mon, 12 Apr 2010 08:35:05 +0000 (10:35 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 19 Apr 2010 17:58:32 +0000 (19:58 +0200)
If there is a permanent error condition when communicating with the IRM,
after the sixth error, the retry variable will be decremented to -1.
If, in this case, the bits in channels_mask are not yet exhausted, the
next channel is retried 2^32 times.

To fix this, check that retry is never decremented beyond zero.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/core-iso.c

index 99c20f1b613ab65f7ea6349647d47b1a4803a222..34a513725c9ee4727b33d69853c3169bf73f3a9e 100644 (file)
@@ -250,8 +250,10 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation,
 
                        /* 1394-1995 IRM, fall through to retry. */
                default:
-                       if (retry--)
+                       if (retry) {
+                               retry--;
                                i--;
+                       }
                }
        }