瀏覽代碼

firewire: core: fix retries calculation in iso manage_channel()

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>
Clemens Ladisch 15 年之前
父節點
當前提交
3a1f0a0e3d
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/firewire/core-iso.c

+ 3 - 1
drivers/firewire/core-iso.c

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