summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-02-18 14:39:27 +0100
committerDavid S. Miller <davem@davemloft.net>2014-02-18 18:11:05 -0500
commit1c8272bd18cf284de5cb43fb6b0e0457041a17b2 (patch)
tree80b2860c1058e8279fa67c6145788af9cd86b8a7 /net/ieee802154
parent9e5f040d0f0caf84884174abd71be1edde2b88dc (diff)
downloadtalos-obmc-linux-1c8272bd18cf284de5cb43fb6b0e0457041a17b2.tar.gz
talos-obmc-linux-1c8272bd18cf284de5cb43fb6b0e0457041a17b2.zip
ieee802154: fix faulty check in set_phy_params api
phy_set_csma_params has a redundant (and impossible) check for "retries", found by smatch. The check was supposed to be for frame_retries, but wasn't moved during development when phy_set_frame_retries was introduced. Also, maxBE >= 3 as required by the standard is not enforced. Remove the redundant check, assure max_be >= 3 and check -1 <= frame_retries <= 7 in the correct function. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/nl-phy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index c9dfd6f59e34..222310a07762 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -436,8 +436,7 @@ static int phy_set_csma_params(struct wpan_phy *phy, struct genl_info *info)
if (info->attrs[IEEE802154_ATTR_CSMA_MAX_BE])
max_be = nla_get_u8(info->attrs[IEEE802154_ATTR_CSMA_MAX_BE]);
- if (retries > 5 || max_be > 8 || min_be > max_be ||
- retries < -1 || retries > 7)
+ if (retries > 5 || max_be < 3 || max_be > 8 || min_be > max_be)
return -EINVAL;
rc = phy->set_csma_params(phy, min_be, max_be, retries);
@@ -456,6 +455,9 @@ static int phy_set_frame_retries(struct wpan_phy *phy, struct genl_info *info)
s8 retries = nla_get_s8(info->attrs[IEEE802154_ATTR_FRAME_RETRIES]);
int rc;
+ if (retries < -1 || retries > 7)
+ return -EINVAL;
+
rc = phy->set_frame_retries(phy, retries);
if (rc < 0)
return rc;
OpenPOWER on IntegriCloud