2016-08-11 10:32:07

by Altshul, Maxim

[permalink] [raw]
Subject: [PATCH] Add protection to get_expected_throughput opcode

The patch is done with respect to the patch that was applied:
[PATCH v3] mac80211: mesh: Add support for HW RC implementation

1. Patch adds protection as we discussed
2. Patch changes the function call that is made in the mesh patch
to comply with the change.

Maxim Altshul (1):
mac80211: Add protection to get_expected_throughput opcode

net/mac80211/driver-ops.h | 8 ++++----
net/mac80211/sta_info.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

--
2.9.0



2016-08-11 10:32:08

by Altshul, Maxim

[permalink] [raw]
Subject: [PATCH] mac80211: Add protection to get_expected_throughput opcode

To protect the opcode we add a check for sta->uploaded.

This is done to prevent a situation where the function gets
called from userspace for example, before sta is uploaded
to driver, causing a crash.

Also, change headers to comply with the change, wherever the
function was called.

Signed-off-by: Maxim Altshul <[email protected]>
---
net/mac80211/driver-ops.h | 8 ++++----
net/mac80211/sta_info.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 1f75195..ec4a690 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1075,13 +1075,13 @@ static inline void drv_leave_ibss(struct ieee80211_local *local,
}

static inline u32 drv_get_expected_throughput(struct ieee80211_local *local,
- struct ieee80211_sta *sta)
+ struct sta_info *sta)
{
u32 ret = 0;

- trace_drv_get_expected_throughput(sta);
- if (local->ops->get_expected_throughput)
- ret = local->ops->get_expected_throughput(&local->hw, sta);
+ trace_drv_get_expected_throughput(&sta->sta);
+ if (local->ops->get_expected_throughput && sta->uploaded)
+ ret = local->ops->get_expected_throughput(&local->hw, &sta->sta);
trace_drv_return_u32(local, ret);

return ret;
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 8860c6c..6624577 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2108,7 +2108,7 @@ u32 sta_get_expected_throughput(struct sta_info *sta)
if (ref && ref->ops->get_expected_throughput)
thr = ref->ops->get_expected_throughput(sta->rate_ctrl_priv);
else
- thr = drv_get_expected_throughput(local, &sta->sta);
+ thr = drv_get_expected_throughput(local, sta);

return thr;
}
--
2.9.0


2016-08-11 12:56:02

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Add protection to get_expected_throughput opcode

On Thu, 2016-08-11 at 13:38 +0300, Maxim Altshul wrote:
> To protect the opcode we add a check for sta->uploaded.
>
Applied, with a reworded commit message - thanks

johannes

2016-09-04 06:24:52

by Altshul, Maxim

[permalink] [raw]
Subject: RE: [PATCH] Add protection to get_expected_throughput opcode

PiANCj4gV2hlcmUncyB0aGUgcGF0Y2g/DQo+IA0KWW91IGNhbiBzZWUgaXQgb24gbWFjODAyMTEt
bmV4dC4gDQpDb21taXQgNGZkYmM2N2EyNWNlNTc3Yjc5YjNhZjU5NWU4NzRlOWVmOTIxMzI5Zg0K
DQpNYXgNCj4gDQo+IEVtYWlsOiBqdWxpYW4uY2FsYWJ5QGdtYWlsLmNvbQ0KPiBQcm9maWxlOiBo
dHRwOi8vd3d3Lmdvb2dsZS5jb20vcHJvZmlsZXMvanVsaWFuLmNhbGFieS8NCg0KDQo=

2016-09-04 03:22:41

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH] Add protection to get_expected_throughput opcode

Hi Maxim,

On Thu, Aug 11, 2016 at 8:38 PM, Maxim Altshul <[email protected]> wrote:
> The patch is done with respect to the patch that was applied:
> [PATCH v3] mac80211: mesh: Add support for HW RC implementation
>
> 1. Patch adds protection as we discussed
> 2. Patch changes the function call that is made in the mesh patch
> to comply with the change.
>
> Maxim Altshul (1):
> mac80211: Add protection to get_expected_throughput opcode
>
> net/mac80211/driver-ops.h | 8 ++++----
> net/mac80211/sta_info.c | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)

Where's the patch?

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/