Message ID | 1409662348-2475-1-git-send-email-roy.qing.li@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
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 > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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; }