|
4 | 4 | * Copyright 2006-2007 Jiri Benc <[email protected]>
|
5 | 5 | * Copyright 2013-2014 Intel Mobile Communications GmbH
|
6 | 6 | * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
|
7 |
| - * Copyright (C) 2018-2023 Intel Corporation |
| 7 | + * Copyright (C) 2018-2024 Intel Corporation |
8 | 8 | */
|
9 | 9 |
|
10 | 10 | #include <linux/module.h>
|
@@ -1321,9 +1321,13 @@ static int _sta_info_move_state(struct sta_info *sta,
|
1321 | 1321 | sta->sta.addr, new_state);
|
1322 | 1322 |
|
1323 | 1323 | /* notify the driver before the actual changes so it can
|
1324 |
| - * fail the transition |
| 1324 | + * fail the transition if the state is increasing. |
| 1325 | + * The driver is required not to fail when the transition |
| 1326 | + * is decreasing the state, so first, do all the preparation |
| 1327 | + * work and only then, notify the driver. |
1325 | 1328 | */
|
1326 |
| - if (test_sta_flag(sta, WLAN_STA_INSERTED)) { |
| 1329 | + if (new_state > sta->sta_state && |
| 1330 | + test_sta_flag(sta, WLAN_STA_INSERTED)) { |
1327 | 1331 | int err = drv_sta_state(sta->local, sta->sdata, sta,
|
1328 | 1332 | sta->sta_state, new_state);
|
1329 | 1333 | if (err)
|
@@ -1399,6 +1403,16 @@ static int _sta_info_move_state(struct sta_info *sta,
|
1399 | 1403 | break;
|
1400 | 1404 | }
|
1401 | 1405 |
|
| 1406 | + if (new_state < sta->sta_state && |
| 1407 | + test_sta_flag(sta, WLAN_STA_INSERTED)) { |
| 1408 | + int err = drv_sta_state(sta->local, sta->sdata, sta, |
| 1409 | + sta->sta_state, new_state); |
| 1410 | + |
| 1411 | + WARN_ONCE(err, |
| 1412 | + "Driver is not allowed to fail if the sta_state is transitioning down the list: %d\n", |
| 1413 | + err); |
| 1414 | + } |
| 1415 | + |
1402 | 1416 | sta->sta_state = new_state;
|
1403 | 1417 |
|
1404 | 1418 | return 0;
|
|
0 commit comments