staging: wfx: check for memory allocation failures from wfx_alloc_hif
authorColin Ian King <colin.king@canonical.com>
Sat, 21 Dec 2019 00:15:43 +0000 (00:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Jan 2020 10:51:00 +0000 (11:51 +0100)
commit0469fc6a1a8715b5c09117a26700da0d67061fb5
tree5745d279338a9a51335371b91dcae49864df1bf1
parent5f33771fb0ac484d6e8cc34cb1e27c37442cd0db
staging: wfx: check for memory allocation failures from wfx_alloc_hif

Currently calls to wfx_alloc_hif are not checking for a null return
when a memory allocation fails and this leads to null pointer
dereferencing issues.  Fix this by adding null pointer checks and
returning passing down -ENOMEM errors where necessary. The error
checking in the current driver is a bit sparse, so this may need
some extra attention later if required.

Fixes: f95a29d40782 ("staging: wfx: add HIF commands helpers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20191221001543.15255-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/wfx/hif_tx.c
drivers/staging/wfx/sta.c