mhi: core: Read transfer length from an event properly

When MHI Driver receives an EOT event, it reads xfer_len from the
event in the last TRE. The value is under control of the MHI device
and never validated by Host MHI driver. The value should never be
larger than the real size of the buffer but a malicious device can
set the value 0xFFFF as maximum. This causes driver to memory
overflow (both read or write). Fix this issue by reading minimum of
transfer length from event and the buffer length provided.

Change-Id: Iac095dfc85f70ffbb0fdb6cf9b2331469439e1ff
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
1 file changed