提交 876727ea 编写于 作者: D David Herrmann 提交者: Jiri Kosina

HID: wiimote: discard invalid EXT data reports

If an extension device isn't initialized properly, or during hardware
initialization, a device might send extension data which is all 0xff.
This is ambigious because this is also a valid normal data report. But
it is impossible, under normal conditions, to trigger valid reports with
all 0xff. Hence, we can safely ignore them.
Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 ee286c2e
......@@ -1276,11 +1276,19 @@ static bool valid_ext_handler(const struct wiimod_ops *ops, size_t len)
static void handler_ext(struct wiimote_data *wdata, const __u8 *payload,
size_t len)
{
static const __u8 invalid[21] = { 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff };
const __u8 *iter, *mods;
const struct wiimod_ops *ops;
bool is_mp;
if (len < 6)
if (len > 21)
len = 21;
if (len < 6 || !memcmp(payload, invalid, len))
return;
/* if MP is active, track MP slot hotplugging */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册