linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
@ 2020-01-14 14:54 Colin King
  2020-01-15 17:29 ` Joakim Tjernlund
  2020-01-15 22:06 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2020-01-14 14:54 UTC (permalink / raw)
  To: Zhao Qiang, David S . Miller, netdev, linuxppc-dev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Array utdm_info is declared as an array of MAX_HDLC_NUM (4) elements
however up to UCC_MAX_NUM (8) elements are potentially being written
to it.  Currently we have an array out-of-bounds write error on the
last 4 elements. Fix this by making utdm_info UCC_MAX_NUM elements in
size.

Addresses-Coverity: ("Out-of-bounds write")
Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wan/fsl_ucc_hdlc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index 94e870f48e21..9edd94679283 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -73,7 +73,7 @@ static struct ucc_tdm_info utdm_primary_info = {
 	},
 };
 
-static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM];
+static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
 
 static int uhdlc_init(struct ucc_hdlc_private *priv)
 {
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
  2020-01-14 14:54 [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info Colin King
@ 2020-01-15 17:29 ` Joakim Tjernlund
  2020-01-15 22:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Joakim Tjernlund @ 2020-01-15 17:29 UTC (permalink / raw)
  To: linuxppc-dev, netdev, colin.king, qiang.zhao, davem
  Cc: kernel-janitors, linux-kernel

On Tue, 2020-01-14 at 14:54 +0000, Colin King wrote:
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> Array utdm_info is declared as an array of MAX_HDLC_NUM (4) elements
> however up to UCC_MAX_NUM (8) elements are potentially being written
> to it.  Currently we have an array out-of-bounds write error on the
> last 4 elements. Fix this by making utdm_info UCC_MAX_NUM elements in
> size.
> 
> Addresses-Coverity: ("Out-of-bounds write")
> Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

This should be sent to stable as well
Cc: <stable@vger.kernel.org> # 4.19.x+

> ---
>  drivers/net/wan/fsl_ucc_hdlc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
> index 94e870f48e21..9edd94679283 100644
> --- a/drivers/net/wan/fsl_ucc_hdlc.c
> +++ b/drivers/net/wan/fsl_ucc_hdlc.c
> @@ -73,7 +73,7 @@ static struct ucc_tdm_info utdm_primary_info = {
>         },
>  };
> 
> -static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM];
> +static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
> 
>  static int uhdlc_init(struct ucc_hdlc_private *priv)
>  {
> --
> 2.24.0
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
  2020-01-14 14:54 [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info Colin King
  2020-01-15 17:29 ` Joakim Tjernlund
@ 2020-01-15 22:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-01-15 22:06 UTC (permalink / raw)
  To: colin.king
  Cc: qiang.zhao, netdev, linuxppc-dev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Tue, 14 Jan 2020 14:54:48 +0000

> From: Colin Ian King <colin.king@canonical.com>
> 
> Array utdm_info is declared as an array of MAX_HDLC_NUM (4) elements
> however up to UCC_MAX_NUM (8) elements are potentially being written
> to it.  Currently we have an array out-of-bounds write error on the
> last 4 elements. Fix this by making utdm_info UCC_MAX_NUM elements in
> size.
> 
> Addresses-Coverity: ("Out-of-bounds write")
> Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied and queued up for -stable.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-15 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-14 14:54 [PATCH] net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info Colin King
2020-01-15 17:29 ` Joakim Tjernlund
2020-01-15 22:06 ` David Miller

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).