Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcd282b3 authored by Subash Abhinov Kasiviswanathan's avatar Subash Abhinov Kasiviswanathan
Browse files

net: qualcomm: rmnet: Fix leak on transmit failure



If a skb in transmit path does not have sufficient headroom to add
the map header, the skb is not sent out and is never freed.

CRs-Fixed: 2156182
Change-Id: Ic19cf2a1183c4aceb5174d6e77f8fd73152b6cd2
Fixes: ceed73a2 ("drivers: net: ethernet: qualcomm: rmnet: Initial implementation")
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 6348f9f9
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -126,12 +126,12 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,

	if (skb_headroom(skb) < required_headroom) {
		if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL))
			return RMNET_MAP_CONSUMED;
			goto fail;
	}

	map_header = rmnet_map_add_map_header(skb, additional_header_len, 0);
	if (!map_header)
		return RMNET_MAP_CONSUMED;
		goto fail;

	if (port->egress_data_format & RMNET_EGRESS_FORMAT_MUXING) {
		if (mux_id == 0xff)
@@ -143,6 +143,10 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
	skb->protocol = htons(ETH_P_MAP);

	return RMNET_MAP_SUCCESS;

fail:
	kfree_skb(skb);
	return RMNET_MAP_CONSUMED;
}

static void