Skip to content

Commit 1ba3980

Browse files
tgrafdavem330
authored andcommitted
openvswitch: packet messages need their own probe attribtue
User space is currently sending a OVS_FLOW_ATTR_PROBE for both flow and packet messages. This leads to an out-of-bounds access in ovs_packet_cmd_execute() because OVS_FLOW_ATTR_PROBE > OVS_PACKET_ATTR_MAX. Introduce a new OVS_PACKET_ATTR_PROBE with the same numeric value as OVS_FLOW_ATTR_PROBE to grow the range of accepted packet attributes while maintaining to be binary compatible with existing OVS binaries. Fixes: 05da589 ("openvswitch: Add support for OVS_FLOW_ATTR_PROBE.") Reported-by: Sander Eikelenboom <linux@eikelenboom.it> Tracked-down-by: Florian Westphal <fw@strlen.de> Signed-off-by: Thomas Graf <tgraf@suug.ch> Reviewed-by: Jesse Gross <jesse@nicira.com> Acked-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 776d4e9 commit 1ba3980

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/uapi/linux/openvswitch.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ enum ovs_packet_attr {
174174
OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
175175
OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_*
176176
attributes. */
177+
OVS_PACKET_ATTR_UNUSED1,
178+
OVS_PACKET_ATTR_UNUSED2,
179+
OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe,
180+
error logging should be suppressed. */
177181
__OVS_PACKET_ATTR_MAX
178182
};
179183

net/openvswitch/datapath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
524524
struct vport *input_vport;
525525
int len;
526526
int err;
527-
bool log = !a[OVS_FLOW_ATTR_PROBE];
527+
bool log = !a[OVS_PACKET_ATTR_PROBE];
528528

529529
err = -EINVAL;
530530
if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
@@ -610,6 +610,7 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
610610
[OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
611611
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
612612
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
613+
[OVS_PACKET_ATTR_PROBE] = { .type = NLA_FLAG },
613614
};
614615

615616
static const struct genl_ops dp_packet_genl_ops[] = {

0 commit comments

Comments
 (0)