From: Kalle Valo <kvalo@codeaurora.org>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Amitkumar Karwar" <amitkarwar@gmail.com>,
"Ganapathi Bhat" <ganapathi.bhat@nxp.com>,
"Xinming Hu" <huxinming820@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Cathy Luo" <cluo@marvell.com>,
"Avinash Patil" <patila@marvell.com>,
"Marek Behún" <marek.behun@nic.cz>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mwifiex: Fix memory corruption in dump_station
Date: Mon, 18 May 2020 12:19:07 +0000 (UTC) [thread overview]
Message-ID: <20200518121907.E660AC433D2@smtp.codeaurora.org> (raw)
In-Reply-To: <20200515075924.13841-1-pali@kernel.org>
Pali Rohár <pali@kernel.org> wrote:
> The mwifiex_cfg80211_dump_station() uses static variable for iterating
> over a linked list of all associated stations (when the driver is in UAP
> role). This has a race condition if .dump_station is called in parallel
> for multiple interfaces. This corruption can be triggered by registering
> multiple SSIDs and calling, in parallel for multiple interfaces
> iw dev <iface> station dump
>
> [16750.719775] Unable to handle kernel paging request at virtual address dead000000000110
> ...
> [16750.899173] Call trace:
> [16750.901696] mwifiex_cfg80211_dump_station+0x94/0x100 [mwifiex]
> [16750.907824] nl80211_dump_station+0xbc/0x278 [cfg80211]
> [16750.913160] netlink_dump+0xe8/0x320
> [16750.916827] netlink_recvmsg+0x1b4/0x338
> [16750.920861] ____sys_recvmsg+0x7c/0x2b0
> [16750.924801] ___sys_recvmsg+0x70/0x98
> [16750.928564] __sys_recvmsg+0x58/0xa0
> [16750.932238] __arm64_sys_recvmsg+0x28/0x30
> [16750.936453] el0_svc_common.constprop.3+0x90/0x158
> [16750.941378] do_el0_svc+0x74/0x90
> [16750.944784] el0_sync_handler+0x12c/0x1a8
> [16750.948903] el0_sync+0x114/0x140
> [16750.952312] Code: f9400003 f907f423 eb02007f 54fffd60 (b9401060)
> [16750.958583] ---[ end trace c8ad181c2f4b8576 ]---
>
> This patch drops the use of the static iterator, and instead every time
> the function is called iterates to the idx-th position of the
> linked-list.
>
> It would be better to convert the code not to use linked list for
> associated stations storage (since the chip has a limited number of
> associated stations anyway - it could just be an array). Such a change
> may be proposed in the future. In the meantime this patch can backported
> into stable kernels in this simple form.
>
> Fixes: 8baca1a34d4c ("mwifiex: dump station support in uap mode")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Acked-by: Ganapathi Bhat <ganapathi.bhat@nxp.com>
Patch applied to wireless-drivers-next.git, thanks.
3aa42bae9c4d mwifiex: Fix memory corruption in dump_station
--
https://patchwork.kernel.org/patch/11550701/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
prev parent reply other threads:[~2020-05-18 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 7:59 [PATCH] mwifiex: Fix memory corruption in dump_station Pali Rohár
2020-05-16 8:07 ` [EXT] " Ganapathi Bhat
2020-05-18 12:19 ` Kalle Valo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200518121907.E660AC433D2@smtp.codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=amitkarwar@gmail.com \
--cc=cluo@marvell.com \
--cc=davem@davemloft.net \
--cc=ganapathi.bhat@nxp.com \
--cc=huxinming820@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=marek.behun@nic.cz \
--cc=netdev@vger.kernel.org \
--cc=pali@kernel.org \
--cc=patila@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).