LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [BUG] mwifiex: possible null-pointer dereference in mwifiex_dnld_cmd_to_fw()
@ 2021-07-31  4:13 Li Tuo
  2021-08-02 20:44 ` Brian Norris
  0 siblings, 1 reply; 4+ messages in thread
From: Li Tuo @ 2021-07-31  4:13 UTC (permalink / raw)
  To: amitkarwar, ganapathi017, sharvari.harisangam, huxinming820,
	kvalo, davem, kuba
  Cc: linux-wireless, netdev, linux-kernel, baijiaju1990

Hello,

Our static analysis tool finds a possible null-pointer dereference in 
the mwifiex driver in Linux 5.14.0-rc3:

The variable cmd_node->cmd_skb->data is assigned to the variable 
host_cmd, and host_cmd is checked in:
190:    if (host_cmd == NULL || host_cmd->size == 0)

This indicates that host_cmd can be NULL.
If so, the function mwifiex_recycle_cmd_node() will be called with the 
argument cmd_node:
196:    mwifiex_recycle_cmd_node(adapter, cmd_node);

In this called function, the variable cmd_node->cmd_skb->data is 
assigned to the variable host_cmd, too.
Thus the variable host_cmd in the function mwifiex_recycle_cmd_node() 
can be also NULL.
However, it is dereferenced when calling le16_to_cpu():
144:    le16_to_cpu(host_cmd->command)

I am not quite sure whether this possible null-pointer dereference is 
real and how to fix it if it is real.
Any feedback would be appreciated, thanks!

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>

Best wishes,
Tuo Li

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [BUG] mwifiex: possible null-pointer dereference in mwifiex_dnld_cmd_to_fw()
@ 2021-07-31  3:45 Li Tuo
  0 siblings, 0 replies; 4+ messages in thread
From: Li Tuo @ 2021-07-31  3:45 UTC (permalink / raw)
  To: 3chas3; +Cc: linux-atm-general, netdev, linux-kernel, baijiaju1990

Hello,

Our static analysis tool finds a possible null-pointer dereference in 
the mwifiex driver in Linux 5.14.0-rc3:

The variable cmd_node->cmd_skb->data is assigned to the variable 
host_cmd, and host_cmd is checked in:
190:    if (host_cmd == NULL || host_cmd->size == 0)

This indicates that host_cmd can be NULL.
If so, the function mwifiex_recycle_cmd_node() will be called with the 
argument cmd_node:
196:    mwifiex_recycle_cmd_node(adapter, cmd_node);

In this called function, the variable cmd_node->cmd_skb->data is 
assigned to the variable host_cmd, too.
Thus the variable host_cmd in the function mwifiex_recycle_cmd_node() 
can be also NULL.
However, it is dereferenced when calling le16_to_cpu():
144:    le16_to_cpu(host_cmd->command)

I am not quite sure whether this possible null-pointer dereference is 
real and how to fix it if it is real.
Any feedback would be appreciated, thanks!

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>

Best wishes,
Tuo Li

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-03  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  4:13 [BUG] mwifiex: possible null-pointer dereference in mwifiex_dnld_cmd_to_fw() Li Tuo
2021-08-02 20:44 ` Brian Norris
2021-08-03  2:34   ` Li Tuo
  -- strict thread matches above, loose matches on Subject: below --
2021-07-31  3:45 Li Tuo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).