* [PATCH] openvswitch: fix a memory leak
@ 2014-09-02 12:52 roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w
2014-09-02 20:18 ` Pravin Shelar
2014-09-02 21:01 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w @ 2014-09-02 12:52 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, dev-yBygre7rU0TnMu66kgdUjQ,
pshelar-l0M0P4e3n4LQT0dZR+AlfA
From: Li RongQing <roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
The user_skb maybe be leaked if the operation on it failed and codes
skipped into the label "out:" without calling genlmsg_unicast.
Cc: Pravin Shelar <pshelar-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Li RongQing <roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
net/openvswitch/datapath.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7228ec3..35d866f 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -404,7 +404,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
{
struct ovs_header *upcall;
struct sk_buff *nskb = NULL;
- struct sk_buff *user_skb; /* to be queued to userspace */
+ struct sk_buff *user_skb = NULL; /* to be queued to userspace */
struct nlattr *nla;
struct genl_info info = {
.dst_sk = ovs_dp_get_net(dp)->genl_sock,
@@ -494,9 +494,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
+ user_skb = NULL;
out:
if (err)
skb_tx_error(skb);
+ kfree_skb(user_skb);
kfree_skb(nskb);
return err;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] openvswitch: fix a memory leak
2014-09-02 12:52 [PATCH] openvswitch: fix a memory leak roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w
@ 2014-09-02 20:18 ` Pravin Shelar
2014-09-02 21:01 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Pravin Shelar @ 2014-09-02 20:18 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev, dev@openvswitch.org
On Tue, Sep 2, 2014 at 5:52 AM, <roy.qing.li@gmail.com> wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
>
> The user_skb maybe be leaked if the operation on it failed and codes
> skipped into the label "out:" without calling genlmsg_unicast.
>
> Cc: Pravin Shelar <pshelar@nicira.com>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Looks good.
Acked-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> net/openvswitch/datapath.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 7228ec3..35d866f 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -404,7 +404,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
> {
> struct ovs_header *upcall;
> struct sk_buff *nskb = NULL;
> - struct sk_buff *user_skb; /* to be queued to userspace */
> + struct sk_buff *user_skb = NULL; /* to be queued to userspace */
> struct nlattr *nla;
> struct genl_info info = {
> .dst_sk = ovs_dp_get_net(dp)->genl_sock,
> @@ -494,9 +494,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
> ((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
>
> err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
> + user_skb = NULL;
> out:
> if (err)
> skb_tx_error(skb);
> + kfree_skb(user_skb);
> kfree_skb(nskb);
> return err;
> }
> --
> 1.7.10.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] openvswitch: fix a memory leak
2014-09-02 12:52 [PATCH] openvswitch: fix a memory leak roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w
2014-09-02 20:18 ` Pravin Shelar
@ 2014-09-02 21:01 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-09-02 21:01 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev, dev, pshelar
From: roy.qing.li@gmail.com
Date: Tue, 2 Sep 2014 20:52:28 +0800
> From: Li RongQing <roy.qing.li@gmail.com>
>
> The user_skb maybe be leaked if the operation on it failed and codes
> skipped into the label "out:" without calling genlmsg_unicast.
>
> Cc: Pravin Shelar <pshelar@nicira.com>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-02 21:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-02 12:52 [PATCH] openvswitch: fix a memory leak roy.qing.li-Re5JQEeQqe8AvxtiuMwx3w
2014-09-02 20:18 ` Pravin Shelar
2014-09-02 21:01 ` 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).