* [PATCH] iwlwifi: mvm: fix an unaligned access
@ 2019-02-18 15:09 wangxuerui
2019-02-18 19:08 ` Jonas Gorski
2019-02-23 8:35 ` [PATCH v2] iwlwifi: mvm: fix unaligned read of rx_pkt_status Wang Xuerui
0 siblings, 2 replies; 5+ messages in thread
From: wangxuerui @ 2019-02-18 15:09 UTC (permalink / raw)
To: linux-wireless; +Cc: Wang Xuerui
From: Wang Xuerui <wangxuerui@qiniu.com>
Tested with a Wireless AC 7265 on a MIPS box, confirmed to fix the
unaligned accesses.
Signed-off-by: Wang Xuerui <wangxuerui@qiniu.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 6653a238f32e..a155e816262e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -57,6 +57,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
+#include <asm/unaligned.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include "iwl-trans.h"
@@ -355,8 +356,8 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data;
hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res));
len = le16_to_cpu(rx_res->byte_count);
- rx_pkt_status = le32_to_cpup((__le32 *)
- (pkt->data + sizeof(*rx_res) + len));
+ rx_pkt_status = le32_to_cpu(get_unaligned((__le32 *)
+ (pkt->data + sizeof(*rx_res) + len)));
/* Dont use dev_alloc_skb(), we'll have enough headroom once
* ieee80211_hdr pulled.
--
2.16.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iwlwifi: mvm: fix an unaligned access
2019-02-18 15:09 [PATCH] iwlwifi: mvm: fix an unaligned access wangxuerui
@ 2019-02-18 19:08 ` Jonas Gorski
2019-02-23 8:35 ` [PATCH v2] iwlwifi: mvm: fix unaligned read of rx_pkt_status Wang Xuerui
1 sibling, 0 replies; 5+ messages in thread
From: Jonas Gorski @ 2019-02-18 19:08 UTC (permalink / raw)
To: wangxuerui; +Cc: linux-wireless
Hi,
On Mon, 18 Feb 2019 at 19:40, <wangxuerui@qiniu.com> wrote:
>
> From: Wang Xuerui <wangxuerui@qiniu.com>
>
> Tested with a Wireless AC 7265 on a MIPS box, confirmed to fix the
> unaligned accesses.
>
> Signed-off-by: Wang Xuerui <wangxuerui@qiniu.com>
> ---
> drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
> index 6653a238f32e..a155e816262e 100644
> --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
> +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
> @@ -57,6 +57,7 @@
> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> *****************************************************************************/
> +#include <asm/unaligned.h>
> #include <linux/etherdevice.h>
> #include <linux/skbuff.h>
> #include "iwl-trans.h"
> @@ -355,8 +356,8 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
> rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data;
> hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res));
> len = le16_to_cpu(rx_res->byte_count);
> - rx_pkt_status = le32_to_cpup((__le32 *)
> - (pkt->data + sizeof(*rx_res) + len));
> + rx_pkt_status = le32_to_cpu(get_unaligned((__le32 *)
> + (pkt->data + sizeof(*rx_res) + len)));
There's get_unaligned_le32() for that purpose.
Regards
Jonas
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] iwlwifi: mvm: fix unaligned read of rx_pkt_status
2019-02-18 15:09 [PATCH] iwlwifi: mvm: fix an unaligned access wangxuerui
2019-02-18 19:08 ` Jonas Gorski
@ 2019-02-23 8:35 ` Wang Xuerui
2019-02-23 8:35 ` [PATCH] " Wang Xuerui
1 sibling, 1 reply; 5+ messages in thread
From: Wang Xuerui @ 2019-02-23 8:35 UTC (permalink / raw)
To: linux-wireless
Fixed redundant calls per review.
Sorry for the delay; I inadvertently broke my test box and it took some
time to fix.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] iwlwifi: mvm: fix unaligned read of rx_pkt_status
2019-02-23 8:35 ` [PATCH v2] iwlwifi: mvm: fix unaligned read of rx_pkt_status Wang Xuerui
@ 2019-02-23 8:35 ` Wang Xuerui
2019-08-23 5:23 ` Luca Coelho
0 siblings, 1 reply; 5+ messages in thread
From: Wang Xuerui @ 2019-02-23 8:35 UTC (permalink / raw)
To: linux-wireless; +Cc: Wang Xuerui
This is present since the introduction of iwlmvm.
Example stack trace on MIPS:
[<ffffffffc0789328>] iwl_mvm_rx_rx_mpdu+0xa8/0xb88 [iwlmvm]
[<ffffffffc0632b40>] iwl_pcie_rx_handle+0x420/0xc48 [iwlwifi]
Tested with a Wireless AC 7265 for ~6 months, confirmed to fix the
problem. No other unaligned accesses are spotted yet.
Signed-off-by: Wang Xuerui <wangxuerui@qiniu.com>
Tested-by: Wang Xuerui <wangxuerui@qiniu.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
index 6653a238f32e..a9f35799e532 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c
@@ -57,6 +57,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
+#include <asm/unaligned.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include "iwl-trans.h"
@@ -355,7 +356,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,
rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data;
hdr = (struct ieee80211_hdr *)(pkt->data + sizeof(*rx_res));
len = le16_to_cpu(rx_res->byte_count);
- rx_pkt_status = le32_to_cpup((__le32 *)
+ rx_pkt_status = get_unaligned_le32((__le32 *)
(pkt->data + sizeof(*rx_res) + len));
/* Dont use dev_alloc_skb(), we'll have enough headroom once
--
2.16.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iwlwifi: mvm: fix unaligned read of rx_pkt_status
2019-02-23 8:35 ` [PATCH] " Wang Xuerui
@ 2019-08-23 5:23 ` Luca Coelho
0 siblings, 0 replies; 5+ messages in thread
From: Luca Coelho @ 2019-08-23 5:23 UTC (permalink / raw)
To: Wang Xuerui, linux-wireless
On Sat, 2019-02-23 at 16:35 +0800, Wang Xuerui wrote:
> This is present since the introduction of iwlmvm.
> Example stack trace on MIPS:
>
> [<ffffffffc0789328>] iwl_mvm_rx_rx_mpdu+0xa8/0xb88 [iwlmvm]
> [<ffffffffc0632b40>] iwl_pcie_rx_handle+0x420/0xc48 [iwlwifi]
>
> Tested with a Wireless AC 7265 for ~6 months, confirmed to fix the
> problem. No other unaligned accesses are spotted yet.
>
> Signed-off-by: Wang Xuerui <wangxuerui@qiniu.com>
> Tested-by: Wang Xuerui <wangxuerui@qiniu.com>
> ---
Thanks! I have applied this to our internal tree and it will reach the
mainline following our normal upstreaming process.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-23 5:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 15:09 [PATCH] iwlwifi: mvm: fix an unaligned access wangxuerui
2019-02-18 19:08 ` Jonas Gorski
2019-02-23 8:35 ` [PATCH v2] iwlwifi: mvm: fix unaligned read of rx_pkt_status Wang Xuerui
2019-02-23 8:35 ` [PATCH] " Wang Xuerui
2019-08-23 5:23 ` Luca Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).