netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios
@ 2017-12-05 20:41 Subash Abhinov Kasiviswanathan
  2017-12-05 20:41 ` [PATCH net 1/2] net: qualcomm: rmnet: Fix leak on transmit failure Subash Abhinov Kasiviswanathan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2017-12-05 20:41 UTC (permalink / raw)
  To: davem, netdev; +Cc: Subash Abhinov Kasiviswanathan

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(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] net: qualcomm: rmnet: Fix leak on transmit failure
  2017-12-05 20:41 [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios Subash Abhinov Kasiviswanathan
@ 2017-12-05 20:41 ` Subash Abhinov Kasiviswanathan
  2017-12-05 20:41 ` [PATCH net 2/2] net: qualcomm: rmnet: Fix leak in device creation failure Subash Abhinov Kasiviswanathan
  2017-12-05 23:04 ` [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2017-12-05 20:41 UTC (permalink / raw)
  To: davem, netdev; +Cc: Subash Abhinov Kasiviswanathan

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.

Fixes: ceed73a2cf4a ("drivers: net: ethernet: qualcomm: rmnet: Initial implementation")
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index f7d1744..ea0d986 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] net: qualcomm: rmnet: Fix leak in device creation failure
  2017-12-05 20:41 [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios Subash Abhinov Kasiviswanathan
  2017-12-05 20:41 ` [PATCH net 1/2] net: qualcomm: rmnet: Fix leak on transmit failure Subash Abhinov Kasiviswanathan
@ 2017-12-05 20:41 ` Subash Abhinov Kasiviswanathan
  2017-12-05 23:04 ` [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Subash Abhinov Kasiviswanathan @ 2017-12-05 20:41 UTC (permalink / raw)
  To: davem, netdev; +Cc: Subash Abhinov Kasiviswanathan

If 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.

Fixes: ceed73a2cf4a ("drivers: net: ethernet: qualcomm: rmnet: Initial implementation")
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
index 71bee1a..df21e90 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c
@@ -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;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios
  2017-12-05 20:41 [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios Subash Abhinov Kasiviswanathan
  2017-12-05 20:41 ` [PATCH net 1/2] net: qualcomm: rmnet: Fix leak on transmit failure Subash Abhinov Kasiviswanathan
  2017-12-05 20:41 ` [PATCH net 2/2] net: qualcomm: rmnet: Fix leak in device creation failure Subash Abhinov Kasiviswanathan
@ 2017-12-05 23:04 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-12-05 23:04 UTC (permalink / raw)
  To: subashab; +Cc: netdev

From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Tue,  5 Dec 2017 13:41:16 -0700

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-05 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-05 20:41 [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios Subash Abhinov Kasiviswanathan
2017-12-05 20:41 ` [PATCH net 1/2] net: qualcomm: rmnet: Fix leak on transmit failure Subash Abhinov Kasiviswanathan
2017-12-05 20:41 ` [PATCH net 2/2] net: qualcomm: rmnet: Fix leak in device creation failure Subash Abhinov Kasiviswanathan
2017-12-05 23:04 ` [PATCH net 0/2] net: qualcomm: rmnet: Fix leaks in failure scenarios David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).