mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
Bluetooth: btbcm: Fix NULL deref in btbcm_get_board_name()
devm_kstrdup() can return a NULL pointer on failure,but this returned value in btbcm_get_board_name() is not checked. Add NULL check in btbcm_get_board_name(), to handle kernel NULL pointer dereference error. Fixes: f9183eaad915 ("Bluetooth: btbcm: Use devm_kstrdup()") Signed-off-by: Charles Han <hanchunchao@inspur.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
30209aeff7
commit
b88655bc65
@ -553,6 +553,9 @@ static const char *btbcm_get_board_name(struct device *dev)
|
||||
|
||||
/* get rid of any '/' in the compatible string */
|
||||
board_type = devm_kstrdup(dev, tmp, GFP_KERNEL);
|
||||
if (!board_type)
|
||||
return NULL;
|
||||
|
||||
strreplace(board_type, '/', '-');
|
||||
|
||||
return board_type;
|
||||
|
Loading…
x
Reference in New Issue
Block a user