2010-06-29 10:50:53

by Yuri Ershov

[permalink] [raw]
Subject: [RFC 0/3] Update for some defects

Hello,

These are some proposals for wireless code minor defects.

Yuri Ershov (3):
mac80211: Put some code under MESH macro
nl80211: Fix memory leaks
cfg80211: Update of regulatory request initiator handling

net/mac80211/tx.c | 2 ++
net/wireless/nl80211.c | 2 ++
net/wireless/reg.c | 3 ++-
3 files changed, 6 insertions(+), 1 deletions(-)



2010-06-29 10:50:53

by Yuri Ershov

[permalink] [raw]
Subject: [RFC 2/3] nl80211: Fix memory leaks

In case of errors during message composing msg should be freed after canceling.

Signed-off-by: Yuri Kululin <[email protected]>
Signed-off-by: Yuri Ershov <[email protected]>
---
net/wireless/nl80211.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index a999fc1..c6bff6b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2769,6 +2769,7 @@ static int nl80211_get_mesh_params(struct sk_buff *skb,

nla_put_failure:
genlmsg_cancel(msg, hdr);
+ nlmsg_free(msg);
err = -EMSGSIZE;
out:
/* Cleanup */
@@ -2960,6 +2961,7 @@ static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info)

nla_put_failure:
genlmsg_cancel(msg, hdr);
+ nlmsg_free(msg);
err = -EMSGSIZE;
out:
mutex_unlock(&cfg80211_mutex);
--
1.7.0.4


2010-06-29 10:50:53

by Yuri Ershov

[permalink] [raw]
Subject: [RFC 1/3] mac80211: Put some code under MESH macro

In the function ieee80211_subif_start_xmit the logic related with
meshdrlen is under CONFIG_MAC80211_MESH macro, but in one place it isn't.
This is some update for this

Signed-off-by: Yuri Ershov <[email protected]>
---
---
net/mac80211/tx.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 698d471..007b76a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1942,11 +1942,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
h_pos += encaps_len;
}

+#ifdef CONFIG_MAC80211_MESH
if (meshhdrlen > 0) {
memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen);
nh_pos += meshhdrlen;
h_pos += meshhdrlen;
}
+#endif

if (ieee80211_is_data_qos(fc)) {
__le16 *qos_control;
--
1.7.0.4


2010-06-29 10:50:53

by Yuri Ershov

[permalink] [raw]
Subject: [RFC 3/3] cfg80211: Update of regulatory request initiator handling

In some cases there could be possible dereferencing freed pointer. The
update is intended to avoid this issue.

Signed-off-by: Yuri Ershov <[email protected]>
---
net/wireless/reg.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1ac2bdd..9ee2be9 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1831,6 +1831,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
{
int r = 0;
struct wiphy *wiphy = NULL;
+ enum nl80211_reg_initiator initiator = reg_request->initiator;

BUG_ON(!reg_request->alpha2);

@@ -1850,7 +1851,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
/* This is required so that the orig_* parameters are saved */
if (r == -EALREADY && wiphy &&
wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY)
- wiphy_update_regulatory(wiphy, reg_request->initiator);
+ wiphy_update_regulatory(wiphy, initiator);
out:
mutex_unlock(&reg_mutex);
mutex_unlock(&cfg80211_mutex);
--
1.7.0.4


2010-06-29 14:00:13

by John W. Linville

[permalink] [raw]
Subject: Re: [RFC 0/3] Update for some defects

On Tue, Jun 29, 2010 at 03:08:05PM +0400, Yuri Ershov wrote:

> Yuri Ershov (3):
> mac80211: Put some code under MESH macro
> nl80211: Fix memory leaks
> cfg80211: Update of regulatory request initiator handling

These all seem fine to me.

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.