linux-stable/drivers/staging
Jiasheng Jiang e2e1ceb8ca staging: greybus: audio: Check null pointer
[ Upstream commit 2e81948177 ]

As the possible alloc failure of devm_kcalloc(), it could return null
pointer.
Therefore, 'strings' should be checked and return NULL if alloc fails to
prevent the dereference of the NULL pointer.
Also, the caller should also deal with the return value of the
gb_generate_enum_strings() and return -ENOMEM if returns NULL.
Moreover, because the memory allocated with devm_kzalloc() will be
freed automatically when the last reference to the device is dropped,
the 'gbe' in gbaudio_tplg_create_enum_kctl() and
gbaudio_tplg_create_enum_ctl() do not need to free manually.
But the 'control' in gbaudio_tplg_create_widget() and
gbaudio_tplg_process_kcontrols() has a specially error handle to
cleanup.
So it should be better to cleanup 'control' when fails.

Fixes: e65579e335 ("greybus: audio: topology: Enable enumerated control support")
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220104150628.1987906-1-jiasheng@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27 09:19:36 +01:00
..
android
axis-fifo
board staging: board: Fix uninitialized spinlock when attaching genpd 2021-09-22 12:26:28 +02:00
clocking-wizard
comedi comedi: vmk80xx: fix bulk and interrupt message timeouts 2021-11-12 14:43:04 +01:00
emxx_udc staging: emxx_udc: fix loop in _nbu2ss_nuke() 2021-06-03 08:59:15 +02:00
exfat
fbtft staging/fbtft: Fix backlight 2021-12-01 09:23:28 +01:00
fieldbus
fsl-dpaa2
fwserial staging: fwserial: fix TIOCSSERIAL permission check 2021-05-14 09:44:11 +02:00
gasket
gdm724x staging: gdm724x: check for overflow in gdm_lte_netif_rx() 2021-07-14 16:53:44 +02:00
goldfish
greybus staging: greybus: audio: Check null pointer 2022-01-27 09:19:36 +01:00
gs_fpgaboot
iio staging: iio: cdc: ad7746: avoid overwrite of num_channels 2021-06-03 08:59:04 +02:00
isdn
kpc2000
ks7010 staging: ks7010: select CRYPTO_HASH/CRYPTO_MICHAEL_MIC 2021-11-17 09:48:43 +01:00
media media: hantro: Fix probe func error path 2022-01-27 09:19:34 +01:00
most staging: most: sound: add sanity check for function argument 2021-03-07 12:20:45 +01:00
mt7621-dma staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c 2021-03-04 10:26:46 +01:00
mt7621-dts staging: mt7621-dts: fix pci address for PCI memory range 2021-07-14 16:53:44 +02:00
mt7621-pci
mt7621-pci-phy
mt7621-pinctrl pinctrl: ralink: rt2880: avoid to error in calls is pin is already enabled 2021-06-23 14:41:27 +02:00
netlogic
nvec
octeon
octeon-usb
olpc_dcon
pi433
qlge
ralink-gdma
rtl8188eu staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data() 2021-03-17 17:03:53 +01:00
rtl8192e staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() 2022-01-27 09:19:32 +01:00
rtl8192u staging: rtl8192u: fix control-message timeouts 2021-11-12 14:43:04 +01:00
rtl8712 staging: r8712u: fix control-message timeout 2021-11-12 14:43:04 +01:00
rtl8723bs staging: rtl8723bs: Fix a resource leak in sd_int_dpc 2021-08-12 13:21:01 +02:00
rts5208 staging: rts5208: Fix get_ms_information() heap buffer size 2021-09-22 12:26:33 +02:00
sm750fb
speakup
unisys
uwb
vc04_services staging: bcm2835-audio: Replace unsafe strcpy() with strscpy() 2021-03-07 12:20:45 +01:00
vme
vt6655
vt6656
wilc1000 wilc1000: fix possible memory leak in cfg_scan_result() 2021-11-17 09:48:34 +01:00
wlan-ng staging: wlan-ng: Avoid bitwise vs logical OR warning in hfa384x_usb_throttlefn() 2022-01-16 09:15:39 +01:00
wusbcore
Kconfig
Makefile