Commit 48d17c51 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

net: bcmasp: Prevent array undereflow in bcmasp_netfilt_get_init()

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: c5d511c4 ("net: bcmasp: Add support for wake on net filters")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: default avatarJustin Chen <justin.chen@broadcom.com>
Link: https://lore.kernel.org/r/b3b47b25-01fc-4d9f-a6c3-e037ad4d71d7@moroto.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c0256168
......@@ -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;
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment