Skip to content

Commit

Permalink
NLA_BINARY misuse bug in HSR
Browse files Browse the repository at this point in the history
Removed .type field from NLA to do proper length checking.
Reported by Daniel Borkmann and Julia Lawall.

Signed-off-by: Peter Heise <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
peterheise authored and davem330 committed Apr 21, 2016
1 parent b7de529 commit f937572
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/hsr/hsr_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const struct nla_policy hsr_policy[IFLA_HSR_MAX + 1] = {
[IFLA_HSR_SLAVE2] = { .type = NLA_U32 },
[IFLA_HSR_MULTICAST_SPEC] = { .type = NLA_U8 },
[IFLA_HSR_VERSION] = { .type = NLA_U8 },
[IFLA_HSR_SUPERVISION_ADDR] = { .type = NLA_BINARY, .len = ETH_ALEN },
[IFLA_HSR_SUPERVISION_ADDR] = { .len = ETH_ALEN },
[IFLA_HSR_SEQ_NR] = { .type = NLA_U16 },
};

Expand Down Expand Up @@ -121,10 +121,9 @@ static struct rtnl_link_ops hsr_link_ops __read_mostly = {


/* attribute policy */
/* NLA_BINARY missing in libnl; use NLA_UNSPEC in userspace instead. */
static const struct nla_policy hsr_genl_policy[HSR_A_MAX + 1] = {
[HSR_A_NODE_ADDR] = { .type = NLA_BINARY, .len = ETH_ALEN },
[HSR_A_NODE_ADDR_B] = { .type = NLA_BINARY, .len = ETH_ALEN },
[HSR_A_NODE_ADDR] = { .len = ETH_ALEN },
[HSR_A_NODE_ADDR_B] = { .len = ETH_ALEN },
[HSR_A_IFINDEX] = { .type = NLA_U32 },
[HSR_A_IF1_AGE] = { .type = NLA_U32 },
[HSR_A_IF2_AGE] = { .type = NLA_U32 },
Expand Down

0 comments on commit f937572

Please sign in to comment.