Input: synaptics-rmi4 - handle incomplete input data

Commit 5b65c2a029 ("HID: rmi: check sanity of the incoming report") added
support for handling incomplete HID reports do to the input data being
corrupted in transit. This patch reimplements this functionality in the
function drivers so they can handle getting less valid data then they
expect.

Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Andrew Duggan
2016-11-08 16:46:20 -08:00
committed by Dmitry Torokhov
parent 3aeed5b573
commit 6d0dbeae71
3 changed files with 61 additions and 20 deletions

View File

@@ -110,6 +110,10 @@ static int rmi_f30_attention(struct rmi_function *fn, unsigned long *irq_bits)
/* Read the gpi led data. */
if (rmi_dev->xport->attn_data) {
if (rmi_dev->xport->attn_size < f30->register_count) {
dev_warn(&fn->dev, "F30 interrupted, but data is missing\n");
return 0;
}
memcpy(f30->data_regs, rmi_dev->xport->attn_data,
f30->register_count);
rmi_dev->xport->attn_data += f30->register_count;