提交 372dd6e8 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

USB: EHCI: fix divide-by-zero bug

This patch (as1164) fixes a bug in the EHCI scheduler.  The interval
value it uses is already in linear format, not logarithmically coded.
The existing code can sometimes crash the system by trying to divide
by zero.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Cc: Stable <stable@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 67b2e029
...@@ -918,7 +918,7 @@ iso_stream_init ( ...@@ -918,7 +918,7 @@ iso_stream_init (
*/ */
stream->usecs = HS_USECS_ISO (maxp); stream->usecs = HS_USECS_ISO (maxp);
bandwidth = stream->usecs * 8; bandwidth = stream->usecs * 8;
bandwidth /= 1 << (interval - 1); bandwidth /= interval;
} else { } else {
u32 addr; u32 addr;
...@@ -951,7 +951,7 @@ iso_stream_init ( ...@@ -951,7 +951,7 @@ iso_stream_init (
} else } else
stream->raw_mask = smask_out [hs_transfers - 1]; stream->raw_mask = smask_out [hs_transfers - 1];
bandwidth = stream->usecs + stream->c_usecs; bandwidth = stream->usecs + stream->c_usecs;
bandwidth /= 1 << (interval + 2); bandwidth /= interval << 3;
/* stream->splits gets created from raw_mask later */ /* stream->splits gets created from raw_mask later */
stream->address = cpu_to_hc32(ehci, addr); stream->address = cpu_to_hc32(ehci, addr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册