* [PATCH] ath9k_htc: Fix skb leaks
@ 2013-01-02 3:49 Larry Finger
[not found] ` <1357098567-8558-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Larry Finger @ 2013-01-02 3:49 UTC (permalink / raw)
To: linville
Cc: linux-wireless, Larry Finger, netdev, Stable, Luis R. Rodriguez,
Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel,
linux-kernel
Running with kmemleak shows that this driver leaks every skb allocated in
routine htc_connect_service() whether the service connection succeeds or
fails.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
Cc: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Cc: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org
Cc: ath9k-devel@lists.ath9k.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/wireless/ath/ath9k/htc_hst.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 4a9570d..a304748 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -278,10 +278,12 @@ int htc_connect_service(struct htc_target *target,
if (!time_left) {
dev_err(target->dev, "Service connection timeout for: %d\n",
service_connreq->service_id);
- return -ETIMEDOUT;
+ ret = -ETIMEDOUT;
+ goto err;
}
*conn_rsp_epid = target->conn_rsp_epid;
+ kfree_skb(skb);
return 0;
err:
kfree_skb(skb);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 6+ messages in thread[parent not found: <1357098567-8558-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>]
* Re: [PATCH] ath9k_htc: Fix skb leaks [not found] ` <1357098567-8558-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org> @ 2013-01-02 4:30 ` Sujith Manoharan 2013-01-02 4:57 ` Larry Finger 0 siblings, 1 reply; 6+ messages in thread From: Sujith Manoharan @ 2013-01-02 4:30 UTC (permalink / raw) To: Larry Finger Cc: linville-2XuSBdqkA4R54TAoqtyWWQ, linux-wireless-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, Stable, Luis R. Rodriguez, Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel-xDcbHBWguxHbcTqmT+pZeQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA Larry Finger wrote: > diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c > index 4a9570d..a304748 100644 > --- a/drivers/net/wireless/ath/ath9k/htc_hst.c > +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c > @@ -278,10 +278,12 @@ int htc_connect_service(struct htc_target *target, > if (!time_left) { > dev_err(target->dev, "Service connection timeout for: %d\n", > service_connreq->service_id); > - return -ETIMEDOUT; > + ret = -ETIMEDOUT; > + goto err; > } > > *conn_rsp_epid = target->conn_rsp_epid; > + kfree_skb(skb); > return 0; > err: > kfree_skb(skb); The allocated skb should be freed in the TX completion hander, ath9k_htc_txcompletion_cb() - doing it in htc_connect_service() is wrong, I think. Sujith -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ath9k_htc: Fix skb leaks 2013-01-02 4:30 ` Sujith Manoharan @ 2013-01-02 4:57 ` Larry Finger 2013-01-02 5:26 ` Sujith Manoharan 0 siblings, 1 reply; 6+ messages in thread From: Larry Finger @ 2013-01-02 4:57 UTC (permalink / raw) To: Sujith Manoharan Cc: linville, linux-wireless, netdev, Stable, Luis R. Rodriguez, Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel, linux-kernel On 01/01/2013 10:30 PM, Sujith Manoharan wrote: > Larry Finger wrote: >> diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c >> index 4a9570d..a304748 100644 >> --- a/drivers/net/wireless/ath/ath9k/htc_hst.c >> +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c >> @@ -278,10 +278,12 @@ int htc_connect_service(struct htc_target *target, >> if (!time_left) { >> dev_err(target->dev, "Service connection timeout for: %d\n", >> service_connreq->service_id); >> - return -ETIMEDOUT; >> + ret = -ETIMEDOUT; >> + goto err; >> } >> >> *conn_rsp_epid = target->conn_rsp_epid; >> + kfree_skb(skb); >> return 0; >> err: >> kfree_skb(skb); > ath9k_htc_txcompletion_cb() > The allocated skb should be freed in the TX completion hander, > ath9k_htc_txcompletion_cb() - doing it in htc_connect_service() is wrong, I think. My only counter argument is that none of the other paths that get to ath9k_htc_txcompletion_cb() leak the skb. It only happens for the path that goes through htc_connect_service(). Larry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ath9k_htc: Fix skb leaks 2013-01-02 4:57 ` Larry Finger @ 2013-01-02 5:26 ` Sujith Manoharan 2013-01-08 16:09 ` Larry Finger 0 siblings, 1 reply; 6+ messages in thread From: Sujith Manoharan @ 2013-01-02 5:26 UTC (permalink / raw) To: Larry Finger Cc: linville, linux-wireless, netdev, Stable, Luis R. Rodriguez, Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel, linux-kernel Larry Finger wrote: > My only counter argument is that none of the other paths that get to > ath9k_htc_txcompletion_cb() leak the skb. It only happens for the path that goes > through htc_connect_service(). Sure, but the TX completion handler would be invoked for every skb that is passed to the USB layer, including the ones that are allocated in htc_hst.c. When this skb goes down to hif_usb.c, a URB is allocated and I am not sure how freeing the skb before the USB layer invokes the completion handler for the URB is correct. I'll come up with a patch and see if kmemleak still complains. Sujith ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ath9k_htc: Fix skb leaks 2013-01-02 5:26 ` Sujith Manoharan @ 2013-01-08 16:09 ` Larry Finger 2013-01-09 8:19 ` Sujith Manoharan 0 siblings, 1 reply; 6+ messages in thread From: Larry Finger @ 2013-01-08 16:09 UTC (permalink / raw) To: Sujith Manoharan Cc: linville, linux-wireless, netdev, Stable, Luis R. Rodriguez, Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel, linux-kernel On 01/01/2013 11:26 PM, Sujith Manoharan wrote: > Larry Finger wrote: >> My only counter argument is that none of the other paths that get to >> ath9k_htc_txcompletion_cb() leak the skb. It only happens for the path that goes >> through htc_connect_service(). > > Sure, but the TX completion handler would be invoked for every skb that is passed > to the USB layer, including the ones that are allocated in htc_hst.c. When this > skb goes down to hif_usb.c, a URB is allocated and I am not sure how freeing > the skb before the USB layer invokes the completion handler for the URB is correct. > > I'll come up with a patch and see if kmemleak still complains. Did I miss your posting on this issue? Larry ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ath9k_htc: Fix skb leaks 2013-01-08 16:09 ` Larry Finger @ 2013-01-09 8:19 ` Sujith Manoharan 0 siblings, 0 replies; 6+ messages in thread From: Sujith Manoharan @ 2013-01-09 8:19 UTC (permalink / raw) To: Larry Finger Cc: linville, linux-wireless, netdev, Stable, Luis R. Rodriguez, Vasanthakumar Thiagarajan, Senthil Balasubramanian, ath9k-devel, linux-kernel Larry Finger wrote: > > I'll come up with a patch and see if kmemleak still complains. > > Did I miss your posting on this issue? Nope, I haven't got to this yet, sorry. I'll try to send a patch by today. Sujith ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-01-09 8:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-02 3:49 [PATCH] ath9k_htc: Fix skb leaks Larry Finger
[not found] ` <1357098567-8558-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2013-01-02 4:30 ` Sujith Manoharan
2013-01-02 4:57 ` Larry Finger
2013-01-02 5:26 ` Sujith Manoharan
2013-01-08 16:09 ` Larry Finger
2013-01-09 8:19 ` Sujith Manoharan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox