提交 7da19971 编写于 作者: M Marek Lindner 提交者: Antonio Quartulli

batman-adv: check return value of pskb_trim_rcsum()

Reported-by: NSven Eckelmann <sven@narfation.org>
Signed-off-by: NMarek Lindner <lindner_marek@yahoo.de>
Acked-by: NMartin Hundebøll <martin@hundeboll.net>
Signed-off-by: NAntonio Quartulli <ordex@autistici.org>
上级 293c9c1c
...@@ -1514,6 +1514,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -1514,6 +1514,7 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
struct ethhdr *ethhdr, ethhdr_tmp; struct ethhdr *ethhdr, ethhdr_tmp;
uint8_t *orig_dest, ttl, ttvn; uint8_t *orig_dest, ttl, ttvn;
unsigned int coding_len; unsigned int coding_len;
int err;
/* Save headers temporarily */ /* Save headers temporarily */
memcpy(&coded_packet_tmp, skb->data, sizeof(coded_packet_tmp)); memcpy(&coded_packet_tmp, skb->data, sizeof(coded_packet_tmp));
...@@ -1568,8 +1569,11 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb, ...@@ -1568,8 +1569,11 @@ batadv_nc_skb_decode_packet(struct batadv_priv *bat_priv, struct sk_buff *skb,
coding_len); coding_len);
/* Resize decoded skb if decoded with larger packet */ /* Resize decoded skb if decoded with larger packet */
if (nc_packet->skb->len > coding_len + h_size) if (nc_packet->skb->len > coding_len + h_size) {
pskb_trim_rcsum(skb, coding_len + h_size); err = pskb_trim_rcsum(skb, coding_len + h_size);
if (err)
return NULL;
}
/* Create decoded unicast packet */ /* Create decoded unicast packet */
unicast_packet = (struct batadv_unicast_packet *)skb->data; unicast_packet = (struct batadv_unicast_packet *)skb->data;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册