]> git.baikalelectronics.ru Git - kernel.git/commit
ath6kl: Fix a possible null-pointer dereference in ath6kl_htc_mbox_create()
authorJia-Ju Bai <baijiaju1990@gmail.com>
Mon, 29 Jul 2019 03:03:05 +0000 (11:03 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 4 Sep 2019 06:21:19 +0000 (09:21 +0300)
commitcf882a89ab61f29ccd039fb3246f5e73136b5eb0
treeb9442e599f0ca272fcb26c50d230ea21bd4eaa00
parentcaab6c3cd732eaec2a6f15ae0f2fc685ba5c0674
ath6kl: Fix a possible null-pointer dereference in ath6kl_htc_mbox_create()

In ath6kl_htc_mbox_create(), when kzalloc() on line 2855 fails,
target->dev is assigned to NULL, and ath6kl_htc_mbox_cleanup(target) is
called on line 2885.

In ath6kl_htc_mbox_cleanup(), target->dev is used on line 2895:
    ath6kl_hif_cleanup_scatter(target->dev->ar);

Thus, a null-pointer dereference may occur.

To fix this bug, kfree(target) is called and NULL is returned when
kzalloc() on line 2855 fails.

This bug is found by a static analysis tool STCheck written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath6kl/htc_mbox.c