mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
batman-adv: frag: free unfragmentable packet
The caller of batadv_frag_send_packet() assume that the skb provided to the
function are always consumed. But the pre-check for an empty payload or the
zero fragment size returned an error without any further actions.
A failed pre-check must use the same error handling code as the rest of the
function.
Cc: stable@vger.kernel.org
Fixes: ee75ed8887 ("batman-adv: Fragment and send skbs larger than mtu")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
7a581d9aab
commit
6b628425ae
|
|
@ -518,8 +518,10 @@ int batadv_frag_send_packet(struct sk_buff *skb,
|
|||
mtu = min_t(unsigned int, mtu, BATADV_FRAG_MAX_FRAG_SIZE);
|
||||
max_fragment_size = mtu - header_size;
|
||||
|
||||
if (skb->len == 0 || max_fragment_size == 0)
|
||||
return -EINVAL;
|
||||
if (skb->len == 0 || max_fragment_size == 0) {
|
||||
ret = -EINVAL;
|
||||
goto free_skb;
|
||||
}
|
||||
|
||||
num_fragments = (skb->len - 1) / max_fragment_size + 1;
|
||||
max_fragment_size = (skb->len - 1) / num_fragments + 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user