Staging: batman-adv: Fix skbuff leak in VIS code.
The vis code takes a copy of the data inside the skbuf if it is interesting for us, so we always need to release the skbuf. Reported-by: Linus Luessing <linus.luessing@web.de> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
837b8248f6
commit
8d03847c09
|
@ -939,7 +939,6 @@ int recv_vis_packet(struct sk_buff *skb)
|
||||||
struct vis_packet *vis_packet;
|
struct vis_packet *vis_packet;
|
||||||
struct ethhdr *ethhdr;
|
struct ethhdr *ethhdr;
|
||||||
int hdr_size = sizeof(struct vis_packet);
|
int hdr_size = sizeof(struct vis_packet);
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (skb_headlen(skb) < hdr_size)
|
if (skb_headlen(skb) < hdr_size)
|
||||||
return NET_RX_DROP;
|
return NET_RX_DROP;
|
||||||
|
@ -962,18 +961,18 @@ int recv_vis_packet(struct sk_buff *skb)
|
||||||
case VIS_TYPE_SERVER_SYNC:
|
case VIS_TYPE_SERVER_SYNC:
|
||||||
/* TODO: handle fragmented skbs properly */
|
/* TODO: handle fragmented skbs properly */
|
||||||
receive_server_sync_packet(vis_packet, skb_headlen(skb));
|
receive_server_sync_packet(vis_packet, skb_headlen(skb));
|
||||||
ret = NET_RX_SUCCESS;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIS_TYPE_CLIENT_UPDATE:
|
case VIS_TYPE_CLIENT_UPDATE:
|
||||||
/* TODO: handle fragmented skbs properly */
|
/* TODO: handle fragmented skbs properly */
|
||||||
receive_client_update_packet(vis_packet, skb_headlen(skb));
|
receive_client_update_packet(vis_packet, skb_headlen(skb));
|
||||||
ret = NET_RX_SUCCESS;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* ignore unknown packet */
|
default: /* ignore unknown packet */
|
||||||
ret = NET_RX_DROP;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
|
/* We take a copy of the data in the packet, so we should
|
||||||
|
always free the skbuf. */
|
||||||
|
return NET_RX_DROP;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue