linux/drivers/staging/greybus
Chaitanya Mishra 06162d85f8 staging: greybus: lights: avoid NULL deref
[ Upstream commit efcffd9a6a ]

gb_lights_light_config() stores channel_count before allocating the
channels array. If kcalloc() fails, gb_lights_release() iterates the
non-zero count and dereferences light->channels, which is NULL.

Allocate channels first and only then publish channels_count so the
cleanup path can't walk a NULL pointer.

Fixes: 2870b52bae ("greybus: lights: add lights implementation")
Link: https://lore.kernel.org/all/20260108103700.15384-1-chaitanyamishra.ai@gmail.com/
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Chaitanya Mishra <chaitanyamishra.ai@gmail.com>
Link: https://patch.msgid.link/20260108151254.81553-1-chaitanyamishra.ai@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:59:33 -08:00
..
Documentation staging: greybus: Documentation: firmware: Move logical AND to previous line 2025-07-15 10:09:17 +02:00
arche-apb-ctrl.c staging: Switch back to struct platform_driver::remove() 2024-10-09 11:54:53 +02:00
arche-platform.c staging: Switch back to struct platform_driver::remove() 2024-10-09 11:54:53 +02:00
arche_platform.h staging: greybus: correct SPDX License Identifier 2018-11-09 09:49:02 -08:00
audio_apbridgea.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
audio_apbridgea.h greybus: audio: apbridgea: Remove flexible array from struct audio_apbridgea_hdr 2024-03-05 13:59:14 +00:00
audio_codec.c staging: greybus: Avoid abusing controls_rwsem 2023-07-20 10:02:59 +02:00
audio_codec.h staging: greybus: Avoid abusing controls_rwsem 2023-07-20 10:02:59 +02:00
audio_gb.c staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
audio_helper.c staging: greybus: audio_helper: Use snd_ctl_remove_id() 2023-07-20 10:00:39 +02:00
audio_helper.h staging: greybus: audio: Add helper APIs for dynamic audio modules 2020-07-29 16:40:09 +02:00
audio_manager.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
audio_manager.h staging: greybus: correct SPDX License Identifier 2018-11-09 09:49:02 -08:00
audio_manager_module.c staging: greybus: Constify gb_audio_module_type 2024-03-25 18:25:45 +01:00
audio_manager_private.h staging: greybus: Modify lines end with a '(' 2023-10-17 15:42:27 +02:00
audio_manager_sysfs.c staging: greybus: minor code style fix 2021-02-13 22:37:50 +01:00
audio_module.c staging/greybus: eliminate use of NAME_SIZE for strings 2021-03-10 09:25:33 +01:00
audio_topology.c staging: greybus: audio: remove unused struct gb_mixer_control 2024-06-04 13:35:33 +02:00
authentication.c Revert "staging: greybus: Fix capitalization and punctuation inconsistencies" 2024-09-11 15:56:26 +02:00
bootrom.c Revert "staging: greybus: Fix capitalization and punctuation inconsistencies" 2024-09-11 15:56:26 +02:00
camera.c debugfs_get_aux(): allow storing non-const void * 2025-07-09 13:30:29 +02:00
firmware.h staging: greybus: move core include files to include/linux/greybus/ 2019-08-27 19:02:59 +02:00
fw-core.c staging: greybus: fix alignment of open parenthesis 2023-08-22 15:47:55 +02:00
fw-download.c greybus: Avoid fake flexible array for response data 2024-03-05 13:59:43 +00:00
fw-management.c staging: greybus: Check for string truncation instead of NUL-termination 2025-04-15 16:26:46 +02:00
gb-camera.h greybus: camera-gb: Fix a alignment bug on gb_camera_ops() 2024-08-13 11:26:33 +02:00
gbphy.c staging: greybus: gbphy: fix up const issue with the match callback 2025-07-16 11:38:27 +02:00
gbphy.h staging: greybus: Add identifier name to function definition argument 2020-08-18 16:07:17 +02:00
gpio.c treewide: rename GPIO set callbacks back to their original names 2025-08-07 10:07:06 +02:00
greybus_authentication.h staging: greybus: Replace __attribute__((packed)) by __packed in various instances 2024-03-07 21:40:52 +00:00
greybus_firmware.h staging: greybus: Replaces directive __attribute__((packed)) by __packed as suggested by checkpatch 2024-03-07 21:40:52 +00:00
hid.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
i2c.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
Kconfig leds: Make flash and multicolor dependencies unconditional 2024-03-07 08:48:03 +00:00
light.c staging: greybus: lights: avoid NULL deref 2026-02-26 14:59:33 -08:00
log.c Revert "staging: greybus: Fix capitalization and punctuation inconsistencies" 2024-09-11 15:56:26 +02:00
loopback.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
Makefile staging: greybus: audio: Enable GB codec, audio module compilation. 2020-07-29 16:40:26 +02:00
power_supply.c staging: greybus: power_supply fix alignment 2025-07-15 10:09:47 +02:00
pwm.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
raw.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
sdio.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
spi.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
spilib.c staging: greybus: spi: switch to use spi_alloc_host() 2024-09-03 10:32:50 +02:00
spilib.h staging: greybus: fix up SPDX comment in .h files 2019-08-27 19:02:18 +02:00
TODO staging: greybus: Add TODO item about modernizing the pwm code 2020-12-09 15:49:04 +01:00
uart.c tty: introduce and use tty_port_tty_vhangup() helper 2025-06-17 13:42:33 +02:00
usb.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00
vibrator.c staging: greybus: add missing MODULE_DESCRIPTION() macros 2024-06-24 15:17:58 +02:00