[3/3] batman-adv: Remove hdr_size skb size check in batadv_interface_rx

Message ID 1456655932-22746-3-git-send-email-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit d1c596a379985d56c5e916e57254bffb71780a38
Delegated to: Marek Lindner
Headers

Commit Message

Sven Eckelmann Feb. 28, 2016, 10:38 a.m. UTC
  The callers of batadv_interface_rx have to make sure that enough data can
be pulled from the skb when they read the batman-adv header. The only two
functions using it are either calling pskb_may_pull with hdr_size directly
(batadv_recv_bcast_packet) or indirectly via batadv_check_unicast_packet
(batadv_recv_unicast_packet).

Reported-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/soft-interface.c | 4 ----
 1 file changed, 4 deletions(-)
  

Comments

Marek Lindner March 20, 2016, 10:01 a.m. UTC | #1
On Sunday, February 28, 2016 11:38:52 Sven Eckelmann wrote:
> The callers of batadv_interface_rx have to make sure that enough data can
> be pulled from the skb when they read the batman-adv header. The only two
> functions using it are either calling pskb_may_pull with hdr_size directly
> (batadv_recv_bcast_packet) or indirectly via batadv_check_unicast_packet
> (batadv_recv_unicast_packet).
> 
> Reported-by: Marek Lindner <mareklindner@neomailbox.ch>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/soft-interface.c | 4 ----
>  1 file changed, 4 deletions(-)

Applied in revision d1c596a.

Thanks,
Marek
  

Patch

diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index bdda984..f24dc59 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -413,10 +413,6 @@  void batadv_interface_rx(struct net_device *soft_iface,
 	batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;
 	is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST);
 
-	/* check if enough space is available for pulling, and pull */
-	if (!pskb_may_pull(skb, hdr_size))
-		goto dropped;
-
 	skb_pull_rcsum(skb, hdr_size);
 	skb_reset_mac_header(skb);