2008-04-17 23:05:15

by Reinette Chatre

[permalink] [raw]
Subject: [PATCH] mac80211: correct skb allocation

From: Ester Kummer <[email protected]>

This patch corrects the allocation of skb in ADDBA req/resp and DELBA
it removes redundant space u.addba_* are already counted in sizeof(*mgmt)

Signed-off-by: Ester Kummer <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
---
net/mac80211/mlme.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index c0a5345..b0b079c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1098,8 +1098,8 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid,
struct ieee80211_mgmt *mgmt;
u16 capab;

- skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom + 1 +
- sizeof(mgmt->u.action.u.addba_resp));
+ skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+
if (!skb) {
printk(KERN_DEBUG "%s: failed to allocate buffer "
"for addba resp frame\n", dev->name);
@@ -1147,9 +1147,7 @@ void ieee80211_send_addba_request(struct net_device *dev, const u8 *da,
struct ieee80211_mgmt *mgmt;
u16 capab;

- skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom + 1 +
- sizeof(mgmt->u.action.u.addba_req));
-
+ skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);

if (!skb) {
printk(KERN_ERR "%s: failed to allocate buffer "
@@ -1411,8 +1409,7 @@ void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid,
struct ieee80211_mgmt *mgmt;
u16 params;

- skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom + 1 +
- sizeof(mgmt->u.action.u.delba));
+ skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);

if (!skb) {
printk(KERN_ERR "%s: failed to allocate buffer "
--
1.5.3.4



2008-04-18 17:08:45

by Ron Rindjunsky

[permalink] [raw]
Subject: Re: [PATCH] mac80211: correct skb allocation

> > - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom + 1 +
> > - sizeof(mgmt->u.action.u.addba_resp));
> > + skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
> > +
>
> Forgive my ignorant, unresearched question... :-) What was the "+1"
> and why is it no longer necessary?
>
> John

originaly it was for the category field, but the union covers it as well

ron

2008-04-18 01:59:32

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH] mac80211: correct skb allocation

On Thu, Apr 17, 2008 at 04:05:14PM -0700, Reinette Chatre wrote:
> From: Ester Kummer <[email protected]>
>
> This patch corrects the allocation of skb in ADDBA req/resp and DELBA
> it removes redundant space u.addba_* are already counted in sizeof(*mgmt)
>
> Signed-off-by: Ester Kummer <[email protected]>
> Signed-off-by: Tomas Winkler <[email protected]>
> ---
> net/mac80211/mlme.c | 11 ++++-------
> 1 files changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index c0a5345..b0b079c 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -1098,8 +1098,8 @@ static void ieee80211_send_addba_resp(struct net_device *dev, u8 *da, u16 tid,
> struct ieee80211_mgmt *mgmt;
> u16 capab;
>
> - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom + 1 +
> - sizeof(mgmt->u.action.u.addba_resp));
> + skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
> +

Forgive my ignorant, unresearched question... :-) What was the "+1"
and why is it no longer necessary?

John
--
John W. Linville
[email protected]