OSDN Git Service

ar5523: check NULL before memcpy() in ar5523_cmd()
authorDenis Efremov <efremov@linux.com>
Mon, 30 Sep 2019 20:31:47 +0000 (23:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:34:57 +0000 (20:34 +0100)
commit0cc303ba19f8844236731248ede929b213ad980d
tree6b72c57078b7bf2b26b4b6aa1a13f50c9f3e0ec4
parenta1de70aa867fb1756eafc45584c525cc6e4fdde2
ar5523: check NULL before memcpy() in ar5523_cmd()

commit 315cee426f87658a6799815845788fde965ddaad upstream.

memcpy() call with "idata == NULL && ilen == 0" results in undefined
behavior in ar5523_cmd(). For example, NULL is passed in callchain
"ar5523_stat_work() -> ar5523_cmd_write() -> ar5523_cmd()". This patch
adds ilen check before memcpy() call in ar5523_cmd() to prevent an
undefined behavior.

Cc: Pontus Fuchs <pontus.fuchs@gmail.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: stable@vger.kernel.org
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/ath/ar5523/ar5523.c