net: qualcomm: rmnet: Fix leaks in failure scenarios
Subsystems (3)
cover net: qualcomm: rmnet: Fix leaks in failure scenarios
Patch 1 fixes a leak in transmit path where a skb cannot be transmitted due to insufficient headroom to stamp the map header. Patch 2 fixes a leak in rmnet_newlink() failure because the rmnet endpoint was never freed
Subash Abhinov Kasiviswanathan (2):
net: qualcomm: rmnet: Fix leak on transmit failure
net: qualcomm: rmnet: Fix leak in device creation failure
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 1 + drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 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.
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +6 -2
@@ -133,12 +133,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 )
@@ -150,6 +150,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
Signature · 1 line
1.9.1
PATCH 2/2 net: qualcomm: rmnet: Fix leak in device creation failure
In reply to Subash Abhinov KasiviswanathanIf the rmnet device creation fails in the newlink either while registering with the physical device or after subsequent operations, the rmnet endpoint information is never freed.
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +1 -0
@@ -195,6 +195,7 @@ static int rmnet_newlink(struct net *src_net, struct net_device *dev, err1:rmnet_unregister_real_device (real_dev, port); err0: +kfree (ep);return err; }
Signature · 1 line
1.9.1
David Miller
maintainerFrom: Subash Abhinov Kasiviswanathan <[email protected]>
Date: Tue, 5 Dec 2017 13:41:16 -0700
Quoted 4 lines
Patch 1 fixes a leak in transmit path where a skb cannot be transmitted due to insufficient headroom to stamp the map header. Patch 2 fixes a leak in
rmnet_newlink()failure because the rmnet endpoint was never freed
Series applied, thank you.