usb: rndis_host: Secure rndis_query check against int overflow
authorSzymon Heidrich <szymon.heidrich@gmail.com>
Tue, 3 Jan 2023 09:17:09 +0000 (10:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:29 +0000 (12:02 +0100)
commita713602807f32afc04add331410c77ef790ef77a
tree84201ccc1b4f0ab52e4fa4cd3b434ae9c6fa71f0
parent667ce030bdfb62a86266444b2c3fd6ab98b9df9b
usb: rndis_host: Secure rndis_query check against int overflow

[ Upstream commit c7dd13805f8b8fc1ce3b6d40f6aff47e66b72ad2 ]

Variables off and len typed as uint32 in rndis_query function
are controlled by incoming RNDIS response message thus their
value may be manipulated. Setting off to a unexpectetly large
value will cause the sum with len and 8 to overflow and pass
the implemented validation step. Consequently the response
pointer will be referring to a location past the expected
buffer boundaries allowing information leakage e.g. via
RNDIS_OID_802_3_PERMANENT_ADDRESS OID.

Fixes: ddda08624013 ("USB: rndis_host, various cleanups")
Signed-off-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/rndis_host.c