wil6210: fix invalid memory access for rx_buff_mgmt debugfs
authorDedy Lansky <dlansky@codeaurora.org>
Thu, 23 Aug 2018 11:47:13 +0000 (14:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:45:29 +0000 (18:45 +0100)
[ Upstream commit 4405b632e3da839defec966e4b0be44d0c5e3102 ]

Check rx_buff_mgmt is allocated before accessing its internal fields.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/wil6210/debugfs.c

index 51c3330..ceace95 100644 (file)
@@ -1263,6 +1263,9 @@ static int wil_rx_buff_mgmt_debugfs_show(struct seq_file *s, void *data)
        int num_active;
        int num_free;
 
+       if (!rbm->buff_arr)
+               return -EINVAL;
+
        seq_printf(s, "  size = %zu\n", rbm->size);
        seq_printf(s, "  free_list_empty_cnt = %lu\n",
                   rbm->free_list_empty_cnt);