mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
batman-adv: dat: handle forward allocation error
batadv_dat_forward_data() calls pskb_copy_for_clone() to duplicate an skb
for each DHT candidate, but does not check the return value before passing
it to batadv_send_skb_prepare_unicast_4addr(). That function dereferences
the skb unconditionally, so a failed allocation triggers a NULL pointer
dereference.
Skip forwarding to the current DHT candidate on allocation failure.
Cc: stable@kernel.org
Fixes: 785ea11441 ("batman-adv: Distributed ARP Table - create DHT helper functions")
Reported-by: Yuan Tan <yuantan098@gmail.com>
Reported-by: Yifan Wu <yifanwucs@gmail.com>
Reported-by: Juefei Pu <tomapufckgml@gmail.com>
Reported-by: Xin Liu <bird@lzu.edu.cn>
Reviewed-by: Yuan Tan <yuantan098@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
a340a51ed8
commit
2d8826a2d3
|
|
@ -696,6 +696,9 @@ static bool batadv_dat_forward_data(struct batadv_priv *bat_priv,
|
|||
goto free_orig;
|
||||
|
||||
tmp_skb = pskb_copy_for_clone(skb, GFP_ATOMIC);
|
||||
if (!tmp_skb)
|
||||
goto free_neigh;
|
||||
|
||||
if (!batadv_send_skb_prepare_unicast_4addr(bat_priv, tmp_skb,
|
||||
cand[i].orig_node,
|
||||
packet_subtype)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user