From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932427AbbCCTg1 (ORCPT ); Tue, 3 Mar 2015 14:36:27 -0500 Received: from na3sys009aog110.obsmtp.com ([74.125.149.203]:54115 "HELO na3sys009aog110.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S932357AbbCCTgY convert rfc822-to-8bit (ORCPT ); Tue, 3 Mar 2015 14:36:24 -0500 X-Greylist: delayed 424 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Mar 2015 14:36:24 EST Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: [PATCH net-next] openvswitch: Fix serialization of non-masked set actions. From: Jarno Rajahalme In-Reply-To: <1425350996-2930-1-git-send-email-joestringer@nicira.com> Date: Tue, 3 Mar 2015 11:29:51 -0800 Cc: netdev@vger.kernel.org, pshelar@nicira.com, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <1425350996-2930-1-git-send-email-joestringer@nicira.com> To: Joe Stringer X-Mailer: Apple Mail (2.2070.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for spotting and fixing this, Acked-by: Jarno Rajahalme > On Mar 2, 2015, at 6:49 PM, Joe Stringer wrote: > > Set actions consist of a regular OVS_KEY_ATTR_* attribute nested inside > of a OVS_ACTION_ATTR_SET action attribute. When converting masked actions > back to regular set actions, the inner attribute length was not changed, > ie, double the length being serialized. This patch fixes the bug. > > Fixes: 83d2b9b ("net: openvswitch: Support masked set actions.") > Signed-off-by: Joe Stringer > --- > This fix needs to be applied to net as well; it applies cleanly. > --- > net/openvswitch/flow_netlink.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c > index 216f20b..22b18c1 100644 > --- a/net/openvswitch/flow_netlink.c > +++ b/net/openvswitch/flow_netlink.c > @@ -2253,14 +2253,20 @@ static int masked_set_action_to_set_action_attr(const struct nlattr *a, > struct sk_buff *skb) > { > const struct nlattr *ovs_key = nla_data(a); > + struct nlattr *nla; > size_t key_len = nla_len(ovs_key) / 2; > > /* Revert the conversion we did from a non-masked set action to > * masked set action. > */ > - if (nla_put(skb, OVS_ACTION_ATTR_SET, nla_len(a) - key_len, ovs_key)) > + nla = nla_nest_start(skb, OVS_ACTION_ATTR_SET); > + if (!nla) > return -EMSGSIZE; > > + if (nla_put(skb, nla_type(ovs_key), key_len, nla_data(ovs_key))) > + return -EMSGSIZE; > + > + nla_nest_end(skb, nla); > return 0; > } > > -- > 1.7.10.4 >