greybus: uart: fix incomplete receive-data sanity checks
authorJohan Hovold <johan@hovoldconsulting.com>
Wed, 24 Feb 2016 15:11:51 +0000 (16:11 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 25 Feb 2016 01:26:05 +0000 (17:26 -0800)
commitc5f338c4a040d7d6eefc560f3ee5cdb6ede03b74
tree0a44da777aa518da975986adbc803b17da1a7dfa
parentcb7f00ba5f581ca2f0848dd2ed77f1b9d793c648
greybus: uart: fix incomplete receive-data sanity checks

Fix incomplete receive-data sanity checks.

The payload size was never verified before parsing the uart header and
neither was the uart-header data size verified against the actual
payload size, something which could lead to information leaks when
passing data beyond the payload buffer to the tty layer.

Also remove the incorrect check against the maximum (tx-buffer) payload
size.

Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/uart.c