* [PATCH] brcmsmac: don't leak kernel memory via printk()
@ 2014-12-10 9:39 Brian Norris
2014-12-10 10:30 ` Arend van Spriel
2014-12-18 6:32 ` Brian Norris
0 siblings, 2 replies; 4+ messages in thread
From: Brian Norris @ 2014-12-10 9:39 UTC (permalink / raw)
To: John W. Linville
Cc: Brian Norris, Brett Rudley, Arend van Spriel,
Franky (Zhenhui) Lin, Hante Meuleman, linux-wireless,
brcm80211-dev-list, netdev
Debug code prints the fifo name via custom dev_warn() wrappers. The
fifo_names array is only non-zero when debugging is manually enabled,
which is all well and good. However, it's *not* good that this array
uses zero-length arrays in the non-debug case, and so it doesn't
actually have any memory allocated to it. This means that as far as we
know, fifo_names[i] actually points to garbage memory.
I've seen this in my log:
[ 4601.205511] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211: �GeL txop exceeded phylen 137/256 dur 1602/1504
So let's give this array space enough to fill it with a NULL byte.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Brett Rudley <brudley@broadcom.com>
Cc: Arend van Spriel <arend@broadcom.com>
Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
Cc: Hante Meuleman <meuleman@broadcom.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: brcm80211-dev-list@broadcom.com
Cc: netdev@vger.kernel.org
---
drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 1b474828d5b8..aed0c948dce8 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = {
static const char * const fifo_names[] = {
"AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
#else
-static const char fifo_names[6][0];
+static const char fifo_names[6][1];
#endif
#ifdef DEBUG
--
2.2.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] brcmsmac: don't leak kernel memory via printk()
2014-12-10 9:39 [PATCH] brcmsmac: don't leak kernel memory via printk() Brian Norris
@ 2014-12-10 10:30 ` Arend van Spriel
2014-12-18 6:32 ` Brian Norris
1 sibling, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2014-12-10 10:30 UTC (permalink / raw)
To: Brian Norris, John W. Linville
Cc: Brett Rudley, Franky (Zhenhui) Lin, Hante Meuleman,
linux-wireless, brcm80211-dev-list, netdev
On 10-12-14 10:39, Brian Norris wrote:
> Debug code prints the fifo name via custom dev_warn() wrappers. The
> fifo_names array is only non-zero when debugging is manually enabled,
> which is all well and good. However, it's *not* good that this array
> uses zero-length arrays in the non-debug case, and so it doesn't
> actually have any memory allocated to it. This means that as far as we
> know, fifo_names[i] actually points to garbage memory.
>
> I've seen this in my log:
>
> [ 4601.205511] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211: �GeL txop exceeded phylen 137/256 dur 1602/1504
>
> So let's give this array space enough to fill it with a NULL byte.
>
+ Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Cc: Brett Rudley <brudley@broadcom.com>
- Cc: Arend van Spriel <arend@broadcom.com>
> Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
> Cc: Hante Meuleman <meuleman@broadcom.com>
> Cc: "John W. Linville" <linville@tuxdriver.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: brcm80211-dev-list@broadcom.com
> Cc: netdev@vger.kernel.org
> ---
> drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> index 1b474828d5b8..aed0c948dce8 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> @@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = {
> static const char * const fifo_names[] = {
> "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
> #else
> -static const char fifo_names[6][0];
> +static const char fifo_names[6][1];
> #endif
>
> #ifdef DEBUG
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] brcmsmac: don't leak kernel memory via printk()
2014-12-10 9:39 [PATCH] brcmsmac: don't leak kernel memory via printk() Brian Norris
2014-12-10 10:30 ` Arend van Spriel
@ 2014-12-18 6:32 ` Brian Norris
2014-12-18 13:01 ` Arend van Spriel
1 sibling, 1 reply; 4+ messages in thread
From: Brian Norris @ 2014-12-18 6:32 UTC (permalink / raw)
To: John W. Linville, Kalle Valo, David S. Miller
Cc: Brian Norris, Brett Rudley, Arend van Spriel,
Franky (Zhenhui) Lin, Hante Meuleman, linux-wireless,
brcm80211-dev-list, netdev
+ others [1]
On Wed, Dec 10, 2014 at 1:39 AM, Brian Norris
<computersforpeace@gmail.com> wrote:
> Debug code prints the fifo name via custom dev_warn() wrappers. The
> fifo_names array is only non-zero when debugging is manually enabled,
> which is all well and good. However, it's *not* good that this array
> uses zero-length arrays in the non-debug case, and so it doesn't
> actually have any memory allocated to it. This means that as far as we
> know, fifo_names[i] actually points to garbage memory.
>
> I've seen this in my log:
>
> [ 4601.205511] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211: �GeL txop exceeded phylen 137/256 dur 1602/1504
>
> So let's give this array space enough to fill it with a NULL byte.
>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Cc: Brett Rudley <brudley@broadcom.com>
> Cc: Arend van Spriel <arend@broadcom.com>
> Cc: "Franky (Zhenhui) Lin" <frankyl@broadcom.com>
> Cc: Hante Meuleman <meuleman@broadcom.com>
> Cc: "John W. Linville" <linville@tuxdriver.com>
> Cc: linux-wireless@vger.kernel.org
> Cc: brcm80211-dev-list@broadcom.com
> Cc: netdev@vger.kernel.org
BTW, I guess this qualifies as a security hole, albeit a small one.
Should this be CC: stable@vger.kernel.org?
> ---
> drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> index 1b474828d5b8..aed0c948dce8 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> @@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = {
> static const char * const fifo_names[] = {
> "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
> #else
> -static const char fifo_names[6][0];
> +static const char fifo_names[6][1];
> #endif
>
> #ifdef DEBUG
Brian
[1] http://lwn.net/Articles/626689/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] brcmsmac: don't leak kernel memory via printk()
2014-12-18 6:32 ` Brian Norris
@ 2014-12-18 13:01 ` Arend van Spriel
0 siblings, 0 replies; 4+ messages in thread
From: Arend van Spriel @ 2014-12-18 13:01 UTC (permalink / raw)
To: Brian Norris
Cc: John W. Linville, Kalle Valo, David S. Miller, Brett Rudley,
Franky (Zhenhui) Lin, Hante Meuleman, linux-wireless,
brcm80211-dev-list, netdev
On 12/18/14 07:32, Brian Norris wrote:
> + others [1]
>
> On Wed, Dec 10, 2014 at 1:39 AM, Brian Norris
> <computersforpeace@gmail.com> wrote:
>> Debug code prints the fifo name via custom dev_warn() wrappers. The
>> fifo_names array is only non-zero when debugging is manually enabled,
>> which is all well and good. However, it's *not* good that this array
>> uses zero-length arrays in the non-debug case, and so it doesn't
>> actually have any memory allocated to it. This means that as far as we
>> know, fifo_names[i] actually points to garbage memory.
>>
>> I've seen this in my log:
>>
>> [ 4601.205511] brcmsmac bcma0:1: wl0: brcms_c_d11hdrs_mac80211: �GeL txop exceeded phylen 137/256 dur 1602/1504
>>
>> So let's give this array space enough to fill it with a NULL byte.
>>
>> Signed-off-by: Brian Norris<computersforpeace@gmail.com>
>> Cc: Brett Rudley<brudley@broadcom.com>
>> Cc: Arend van Spriel<arend@broadcom.com>
>> Cc: "Franky (Zhenhui) Lin"<frankyl@broadcom.com>
>> Cc: Hante Meuleman<meuleman@broadcom.com>
>> Cc: "John W. Linville"<linville@tuxdriver.com>
>> Cc: linux-wireless@vger.kernel.org
>> Cc: brcm80211-dev-list@broadcom.com
>> Cc: netdev@vger.kernel.org
>
> BTW, I guess this qualifies as a security hole, albeit a small one.
> Should this be CC: stable@vger.kernel.org?
I have no strong opinion on this, but I guess. Feel free to do so.
Regards,
Arend
>> ---
>> drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> index 1b474828d5b8..aed0c948dce8 100644
>> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> @@ -316,7 +316,7 @@ static const u16 xmtfifo_sz[][NFIFO] = {
>> static const char * const fifo_names[] = {
>> "AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
>> #else
>> -static const char fifo_names[6][0];
>> +static const char fifo_names[6][1];
>> #endif
>>
>> #ifdef DEBUG
>
> Brian
>
> [1] http://lwn.net/Articles/626689/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-18 13:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 9:39 [PATCH] brcmsmac: don't leak kernel memory via printk() Brian Norris
2014-12-10 10:30 ` Arend van Spriel
2014-12-18 6:32 ` Brian Norris
2014-12-18 13:01 ` Arend van Spriel
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).