* [PATCH] staging: rtl8192e: initializing the wep buffer
@ 2019-10-18 4:57 ` Kangjie Lu
0 siblings, 0 replies; 4+ messages in thread
From: Kangjie Lu @ 2019-10-18 4:57 UTC (permalink / raw)
To: kjlu; +Cc: Greg Kroah-Hartman, devel, linux-kernel
The "wep" buffer is not initialized. To avoid memory disclosures,
the fix initializes it, as peer functions like rtllib_ccmp_set_key
do.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
index b1ea650036d2..0931777ed157 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
@@ -232,6 +232,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
if (len < 0 || len > WEP_KEY_LEN)
return -1;
+ memset(wep, 0, sizeof(*wep));
memcpy(wep->key, key, len);
wep->key_len = len;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: rtl8192e: initializing the wep buffer
@ 2019-10-18 4:57 ` Kangjie Lu
0 siblings, 0 replies; 4+ messages in thread
From: Kangjie Lu @ 2019-10-18 4:57 UTC (permalink / raw)
To: kjlu; +Cc: devel, Greg Kroah-Hartman, linux-kernel
The "wep" buffer is not initialized. To avoid memory disclosures,
the fix initializes it, as peer functions like rtllib_ccmp_set_key
do.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
index b1ea650036d2..0931777ed157 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
@@ -232,6 +232,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
if (len < 0 || len > WEP_KEY_LEN)
return -1;
+ memset(wep, 0, sizeof(*wep));
memcpy(wep->key, key, len);
wep->key_len = len;
--
2.17.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rtl8192e: initializing the wep buffer
2019-10-18 4:57 ` Kangjie Lu
@ 2019-10-18 7:47 ` Dan Carpenter
-1 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-10-18 7:47 UTC (permalink / raw)
To: Kangjie Lu; +Cc: devel, Greg Kroah-Hartman, linux-kernel
On Thu, Oct 17, 2019 at 11:57:58PM -0500, Kangjie Lu wrote:
> The "wep" buffer is not initialized. To avoid memory disclosures,
> the fix initializes it, as peer functions like rtllib_ccmp_set_key
> do.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> index b1ea650036d2..0931777ed157 100644
> --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> @@ -232,6 +232,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
> if (len < 0 || len > WEP_KEY_LEN)
> return -1;
>
> + memset(wep, 0, sizeof(*wep));
> memcpy(wep->key, key, len);
> wep->key_len = len;
If we read beyond wep->key_len then it's probably a bug, right? It
doesn't matter whether it's zeroed out or not. Fortunately we never
do:
memcpy(key, wep->key, wep->key_len);
So this change isn't required.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rtl8192e: initializing the wep buffer
@ 2019-10-18 7:47 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-10-18 7:47 UTC (permalink / raw)
To: Kangjie Lu; +Cc: devel, Greg Kroah-Hartman, linux-kernel
On Thu, Oct 17, 2019 at 11:57:58PM -0500, Kangjie Lu wrote:
> The "wep" buffer is not initialized. To avoid memory disclosures,
> the fix initializes it, as peer functions like rtllib_ccmp_set_key
> do.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/staging/rtl8192e/rtllib_crypt_wep.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> index b1ea650036d2..0931777ed157 100644
> --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c
> @@ -232,6 +232,7 @@ static int prism2_wep_set_key(void *key, int len, u8 *seq, void *priv)
> if (len < 0 || len > WEP_KEY_LEN)
> return -1;
>
> + memset(wep, 0, sizeof(*wep));
> memcpy(wep->key, key, len);
> wep->key_len = len;
If we read beyond wep->key_len then it's probably a bug, right? It
doesn't matter whether it's zeroed out or not. Fortunately we never
do:
memcpy(key, wep->key, wep->key_len);
So this change isn't required.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-18 7:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 4:57 [PATCH] staging: rtl8192e: initializing the wep buffer Kangjie Lu
2019-10-18 4:57 ` Kangjie Lu
2019-10-18 7:47 ` Dan Carpenter
2019-10-18 7:47 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.