HID: u2fzero: ignore incomplete packets without data
authorAndrej Shadura <andrew.shadura@collabora.co.uk>
Thu, 16 Sep 2021 16:33:11 +0000 (17:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Oct 2021 13:56:02 +0000 (15:56 +0200)
commita7f4c633ae120562e91a0891101ed44eaa6c6d1e
treee13ea68f604bb07ea529369823b6c9e8c61dc9de
parent3770e21f60fc29326a7f3febfa8adc9a3c2dde62
HID: u2fzero: ignore incomplete packets without data

commit 22d65765f211cc83186fd8b87521159f354c0da9 upstream.

Since the actual_length calculation is performed unsigned, packets
shorter than 7 bytes (e.g. packets without data or otherwise truncated)
or non-received packets ("zero" bytes) can cause buffer overflow.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=214437
Fixes: 42337b9d4d958("HID: add driver for U2F Zero built-in LED and RNG")
Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-u2fzero.c