diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-08-14 07:50:01 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-08-14 08:00:12 -0400 |
commit | cb35fba360dfc3496e5d8a47e23ec5ccdfd90925 (patch) | |
tree | 1298bda5a5f8d7225632d27f82c624d5c3883d33 /net | |
parent | ddfe49b42d8ad4bfdf92d63d4a74f162660d878d (diff) |
nl80211: nl80211hdr_put() doesn't return an ERR_PTR
There are a few places which check nl80211hdr_put() for an ERR_PTR
but actually it returns NULL on error and never error values. In
nl80211_testmode_dump() the return wasn't checked at all so I have
added one.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[some whitespace changes]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/wireless/nl80211.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3fcba69817e5..5f6e982cdcf4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2622,8 +2622,8 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) | |||
2622 | 2622 | ||
2623 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 2623 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
2624 | NL80211_CMD_NEW_KEY); | 2624 | NL80211_CMD_NEW_KEY); |
2625 | if (IS_ERR(hdr)) | 2625 | if (!hdr) |
2626 | return PTR_ERR(hdr); | 2626 | return -ENOBUFS; |
2627 | 2627 | ||
2628 | cookie.msg = msg; | 2628 | cookie.msg = msg; |
2629 | cookie.idx = key_idx; | 2629 | cookie.idx = key_idx; |
@@ -6507,6 +6507,9 @@ static int nl80211_testmode_dump(struct sk_buff *skb, | |||
6507 | NL80211_CMD_TESTMODE); | 6507 | NL80211_CMD_TESTMODE); |
6508 | struct nlattr *tmdata; | 6508 | struct nlattr *tmdata; |
6509 | 6509 | ||
6510 | if (!hdr) | ||
6511 | break; | ||
6512 | |||
6510 | if (nla_put_u32(skb, NL80211_ATTR_WIPHY, phy_idx)) { | 6513 | if (nla_put_u32(skb, NL80211_ATTR_WIPHY, phy_idx)) { |
6511 | genlmsg_cancel(skb, hdr); | 6514 | genlmsg_cancel(skb, hdr); |
6512 | break; | 6515 | break; |
@@ -6951,9 +6954,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, | |||
6951 | 6954 | ||
6952 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 6955 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
6953 | NL80211_CMD_REMAIN_ON_CHANNEL); | 6956 | NL80211_CMD_REMAIN_ON_CHANNEL); |
6954 | 6957 | if (!hdr) { | |
6955 | if (IS_ERR(hdr)) { | 6958 | err = -ENOBUFS; |
6956 | err = PTR_ERR(hdr); | ||
6957 | goto free_msg; | 6959 | goto free_msg; |
6958 | } | 6960 | } |
6959 | 6961 | ||
@@ -7251,9 +7253,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) | |||
7251 | 7253 | ||
7252 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 7254 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
7253 | NL80211_CMD_FRAME); | 7255 | NL80211_CMD_FRAME); |
7254 | 7256 | if (!hdr) { | |
7255 | if (IS_ERR(hdr)) { | 7257 | err = -ENOBUFS; |
7256 | err = PTR_ERR(hdr); | ||
7257 | goto free_msg; | 7258 | goto free_msg; |
7258 | } | 7259 | } |
7259 | } | 7260 | } |
@@ -8132,9 +8133,8 @@ static int nl80211_probe_client(struct sk_buff *skb, | |||
8132 | 8133 | ||
8133 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, | 8134 | hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0, |
8134 | NL80211_CMD_PROBE_CLIENT); | 8135 | NL80211_CMD_PROBE_CLIENT); |
8135 | 8136 | if (!hdr) { | |
8136 | if (IS_ERR(hdr)) { | 8137 | err = -ENOBUFS; |
8137 | err = PTR_ERR(hdr); | ||
8138 | goto free_msg; | 8138 | goto free_msg; |
8139 | } | 8139 | } |
8140 | 8140 | ||