Skip to content
/ linux Public

Commit 0e35db2

Browse files
Yang Yanggregkh
authored andcommitted
batman-adv: avoid OGM aggregation when skb tailroom is insufficient
commit 0d4aef6 upstream. When OGM aggregation state is toggled at runtime, an existing forwarded packet may have been allocated with only packet_len bytes, while a later packet can still be selected for aggregation. Appending in this case can hit skb_put overflow conditions. Reject aggregation when the target skb tailroom cannot accommodate the new packet. The caller then falls back to creating a new forward packet instead of appending. Fixes: c6c8fea ("net: Add batman-adv meshing protocol") Cc: stable@vger.kernel.org Reported-by: Yifan Wu <yifanwucs@gmail.com> Reported-by: Juefei Pu <tomapufckgml@gmail.com> Signed-off-by: Yuan Tan <tanyuan98@outlook.com> Signed-off-by: Xin Liu <bird@lzu.edu.cn> Signed-off-by: Ao Zhou <n05ec@lzu.edu.cn> Signed-off-by: Yang Yang <n05ec@lzu.edu.cn> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f5ed9e5 commit 0e35db2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/batman-adv/bat_iv_ogm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
473473
if (aggregated_bytes > max_bytes)
474474
return false;
475475

476+
if (skb_tailroom(forw_packet->skb) < packet_len)
477+
return false;
478+
476479
if (packet_num >= BATADV_MAX_AGGREGATION_PACKETS)
477480
return false;
478481

0 commit comments

Comments
 (0)