platform/chrome: fix memory corruption in ioctl
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 19 Aug 2022 05:20:36 +0000 (08:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:34:52 +0000 (12:34 +0200)
commitfd1d3b265784a2243fcaef06aebfb2f8ee733cec
tree89be1333dc118565efcb49c2f44ca3180db06464
parent27bb672c0437faf172a85928a3c5fbbc56667635
platform/chrome: fix memory corruption in ioctl

[ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ]

If "s_mem.bytes" is larger than the buffer size it leads to memory
corruption.

Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/Yv8dpCFZJdbUT5ye@kili
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/chrome/cros_ec_chardev.c