[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67ec0129-0067-cdeb-f4e5-2ac22558b3c8@broadcom.com>
Date: Mon, 7 Aug 2023 13:54:49 -0700
From: Justin Chen <justin.chen@...adcom.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Florian Fainelli <florian.fainelli@...adcom.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
bcm-kernel-feedback-list@...adcom.com, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net-next] net: bcmasp: Prevent array undereflow in
bcmasp_netfilt_get_init()
On 8/7/23 6:01 AM, Dan Carpenter wrote:
> The "loc" value comes from the user and it can be negative leading to an
> an array underflow when we check "priv->net_filters[loc].claimed". Fix
> this by changing the type to u32.
>
> Fixes: c5d511c49587 ("net: bcmasp: Add support for wake on net filters")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Reviewed-by: Justin Chen <justin.chen@...adcom.com>
> ---
> Recent code. Only needed on net-next.
>
> drivers/net/ethernet/broadcom/asp2/bcmasp.c | 2 +-
> drivers/net/ethernet/broadcom/asp2/bcmasp.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> index eb35ced1c8ba..d63d321f3e7b 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
> @@ -640,7 +640,7 @@ bool bcmasp_netfilt_check_dup(struct bcmasp_intf *intf,
> * If no more open filters return NULL
> */
> struct bcmasp_net_filter *bcmasp_netfilt_get_init(struct bcmasp_intf *intf,
> - int loc, bool wake_filter,
> + u32 loc, bool wake_filter,
> bool init)
> {
> struct bcmasp_net_filter *nfilter = NULL;
> diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
> index 6bfcaa7f95a8..5b512f7f5e94 100644
> --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h
> +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h
> @@ -566,7 +566,7 @@ void bcmasp_disable_all_filters(struct bcmasp_intf *intf);
> void bcmasp_core_clock_set_intf(struct bcmasp_intf *intf, bool en);
>
> struct bcmasp_net_filter *bcmasp_netfilt_get_init(struct bcmasp_intf *intf,
> - int loc, bool wake_filter,
> + u32 loc, bool wake_filter,
> bool init);
>
> bool bcmasp_netfilt_check_dup(struct bcmasp_intf *intf,
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4206 bytes)
Powered by blists - more mailing lists