From: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dev-yBygre7rU0SM8Zsap4Y0gw@public.gmane.org
Subject: [PATCH net 1/5] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
Date: Sun, 2 Feb 2014 17:08:02 -0800 [thread overview]
Message-ID: <1391389686-34303-2-git-send-email-jesse@nicira.com> (raw)
In-Reply-To: <1391389686-34303-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
From: Thomas Graf <tgraf-G/eBtMaohhA@public.gmane.org>
While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.
This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().
Signed-off-by: Thomas Graf <tgraf-G/eBtMaohhA@public.gmane.org>
Acked-by: Zoltan Kiss <zoltan.kiss-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
---
net/openvswitch/datapath.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index df46928..3ca9121 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -396,7 +396,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
.dst_sk = ovs_dp_get_net(dp)->genl_sock,
.snd_portid = upcall_info->portid,
};
- size_t len;
+ size_t len, plen;
unsigned int hlen;
int err, dp_ifindex;
@@ -466,6 +466,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
skb_zerocopy(user_skb, skb, skb->len, hlen);
+ /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */
+ if (!(dp->user_features & OVS_DP_F_UNALIGNED) &&
+ (plen = (ALIGN(user_skb->len, NLA_ALIGNTO) - user_skb->len)) > 0)
+ memset(skb_put(user_skb, plen), 0, plen);
+
((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
--
1.8.3.2
next prev parent reply other threads:[~2014-02-03 1:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 1:08 [GIT net] Open vSwitch Jesse Gross
[not found] ` <1391389686-34303-1-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2014-02-03 1:08 ` Jesse Gross [this message]
[not found] ` <1391389686-34303-2-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2014-02-03 16:43 ` [PATCH net 1/5] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed Sergei Shtylyov
[not found] ` <52EFC74E.8040906-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2014-02-05 6:02 ` Jesse Gross
2014-02-03 1:08 ` [PATCH net 2/5] openvswitch: Fix kernel panic on ovs_flow_free Jesse Gross
2014-02-03 1:08 ` [PATCH net 3/5] openvswitch: Fix ovs_dp_cmd_msg_size() Jesse Gross
2014-02-03 1:08 ` [PATCH net 4/5] openvswitch: Fix ovs_flow_free() ovs-lock assert Jesse Gross
[not found] ` <1391389686-34303-5-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2014-02-03 16:42 ` Sergei Shtylyov
2014-02-03 1:08 ` [PATCH net 5/5] openvswitch: Suppress error messages on megaflow updates Jesse Gross
[not found] ` <1391389686-34303-6-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2014-02-03 6:55 ` [RFC PATCH] openvswitch: Use net_ratelimit in OVS_NLERR Joe Perches
2014-02-03 21:46 ` Jesse Gross
[not found] ` <CAEP_g=_vvSPLt76VUE66XHJtgCW_05acn-r77PfkJFWBkT0S2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-03 22:08 ` Joe Perches
2014-02-03 23:41 ` Jesse Gross
[not found] ` <CAEP_g=83oVtSTMmLB7O8g=a3e5ghjHp7Bgs-f4nvgqCvWqE5VQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-04 1:06 ` [PATCH] " Joe Perches
2014-02-04 1:18 ` [PATCH] openvswitch: flow_netlink: Use pr_fmt to OVS_NLERR output Joe Perches
2014-02-04 1:29 ` Jesse Gross
2014-02-04 1:29 ` [PATCH] openvswitch: Use net_ratelimit in OVS_NLERR Jesse Gross
-- strict thread matches above, loose matches on Subject: below --
2014-02-05 6:59 [GIT net] Open vSwitch Jesse Gross
2014-02-05 6:59 ` [PATCH net 1/5] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed Jesse Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391389686-34303-2-git-send-email-jesse@nicira.com \
--to=jesse-l0m0p4e3n4lqt0dzr+alfa@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dev-yBygre7rU0SM8Zsap4Y0gw@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).