* [PATCHv2 wpan] ieee802154: hwsim: fix off-by-one in parse nested
@ 2018-11-29 22:41 Alexander Aring
2018-12-02 11:19 ` Stefan Schmidt
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2018-11-29 22:41 UTC (permalink / raw)
To: stefan; +Cc: linux-wpan, Alexander Aring
This patch fixes a off-by-one mistake in nla_parse_nested() functions of
mac802154_hwsim driver. I had to enabled stack protector so I was able
to reproduce it.
Reference: https://github.com/linux-wpan/wpan-tools/issues/17
Signed-off-by: Alexander Aring <aring@mojatatu.com>
---
drivers/net/ieee802154/mac802154_hwsim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index bf70ab892e69..624bff4d3636 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -500,7 +500,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info)
!info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
return -EINVAL;
- if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX + 1,
+ if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
hwsim_edge_policy, NULL))
return -EINVAL;
@@ -550,7 +550,7 @@ static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info)
!info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
return -EINVAL;
- if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX + 1,
+ if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
hwsim_edge_policy, NULL))
return -EINVAL;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2 wpan] ieee802154: hwsim: fix off-by-one in parse nested
2018-11-29 22:41 [PATCHv2 wpan] ieee802154: hwsim: fix off-by-one in parse nested Alexander Aring
@ 2018-12-02 11:19 ` Stefan Schmidt
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Schmidt @ 2018-12-02 11:19 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan
Hello.
On 29.11.18 23:41, Alexander Aring wrote:
> This patch fixes a off-by-one mistake in nla_parse_nested() functions of
> mac802154_hwsim driver. I had to enabled stack protector so I was able
> to reproduce it.
>
> Reference: https://github.com/linux-wpan/wpan-tools/issues/17
>
> Signed-off-by: Alexander Aring <aring@mojatatu.com>
> ---
> drivers/net/ieee802154/mac802154_hwsim.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
> index bf70ab892e69..624bff4d3636 100644
> --- a/drivers/net/ieee802154/mac802154_hwsim.c
> +++ b/drivers/net/ieee802154/mac802154_hwsim.c
> @@ -500,7 +500,7 @@ static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info)
> !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
> return -EINVAL;
>
> - if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX + 1,
> + if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
> info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
> hwsim_edge_policy, NULL))
> return -EINVAL;
> @@ -550,7 +550,7 @@ static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info)
> !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
> return -EINVAL;
>
> - if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX + 1,
> + if (nla_parse_nested(edge_attrs, MAC802154_HWSIM_EDGE_ATTR_MAX,
> info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE],
> hwsim_edge_policy, NULL))
> return -EINVAL;
>
This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!
regards
Stefan Schmidt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-02 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 22:41 [PATCHv2 wpan] ieee802154: hwsim: fix off-by-one in parse nested Alexander Aring
2018-12-02 11:19 ` Stefan Schmidt
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).