Skip to content

Commit cb35fba

Browse files
Dan Carpenterjmberg-intel
authored andcommitted
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>
1 parent ddfe49b commit cb35fba

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

‎net/wireless/nl80211.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,8 +2622,8 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
26222622

26232623
hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
26242624
NL80211_CMD_NEW_KEY);
2625-
if (IS_ERR(hdr))
2626-
return PTR_ERR(hdr);
2625+
if (!hdr)
2626+
return -ENOBUFS;
26272627

26282628
cookie.msg = msg;
26292629
cookie.idx = key_idx;
@@ -6507,6 +6507,9 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
65076507
NL80211_CMD_TESTMODE);
65086508
struct nlattr *tmdata;
65096509

6510+
if (!hdr)
6511+
break;
6512+
65106513
if (nla_put_u32(skb, NL80211_ATTR_WIPHY, phy_idx)) {
65116514
genlmsg_cancel(skb, hdr);
65126515
break;
@@ -6951,9 +6954,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
69516954

69526955
hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
69536956
NL80211_CMD_REMAIN_ON_CHANNEL);
6954-
6955-
if (IS_ERR(hdr)) {
6956-
err = PTR_ERR(hdr);
6957+
if (!hdr) {
6958+
err = -ENOBUFS;
69576959
goto free_msg;
69586960
}
69596961

@@ -7251,9 +7253,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
72517253

72527254
hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
72537255
NL80211_CMD_FRAME);
7254-
7255-
if (IS_ERR(hdr)) {
7256-
err = PTR_ERR(hdr);
7256+
if (!hdr) {
7257+
err = -ENOBUFS;
72577258
goto free_msg;
72587259
}
72597260
}
@@ -8132,9 +8133,8 @@ static int nl80211_probe_client(struct sk_buff *skb,
81328133

81338134
hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
81348135
NL80211_CMD_PROBE_CLIENT);
8135-
8136-
if (IS_ERR(hdr)) {
8137-
err = PTR_ERR(hdr);
8136+
if (!hdr) {
8137+
err = -ENOBUFS;
81388138
goto free_msg;
81398139
}
81408140

0 commit comments

Comments
 (0)