lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPv3WKe3=RDzcp60KdX8Ew8DF=E1Uqgjr1LWQXsgiOdNuDTxSg@mail.gmail.com>
Date:   Fri, 8 Sep 2023 09:11:20 +0200
From:   Marcin Wojtas <mw@...ihalf.com>
To:     Hangyu Hua <hbh25y@...il.com>
Cc:     justin.chen@...adcom.com, florian.fainelli@...adcom.com,
        davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux@...linux.org.uk, nbd@....name,
        john@...ozen.org, sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
        lorenzo@...nel.org, matthias.bgg@...il.com,
        angelogioacchino.delregno@...labora.com,
        maxime.chevallier@...tlin.com, nelson.chang@...iatek.com,
        bcm-kernel-feedback-list@...adcom.com, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH v2 2/3] net: ethernet: mvpp2_main: fix possible OOB write
 in mvpp2_ethtool_get_rxnfc()

pt., 8 wrz 2023 o 08:21 Hangyu Hua <hbh25y@...il.com> napisaƂ(a):
>
> rules is allocated in ethtool_get_rxnfc and the size is determined by
> rule_cnt from user space. So rule_cnt needs to be check before using
> rules to avoid OOB writing or NULL pointer dereference.
>
> Fixes: 90b509b39ac9 ("net: mvpp2: cls: Add Classification offload support")
> Signed-off-by: Hangyu Hua <hbh25y@...il.com>
> ---
>  drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index eb74ccddb440..21c3f9b015c8 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -5586,6 +5586,11 @@ static int mvpp2_ethtool_get_rxnfc(struct net_device *dev,
>                 break;
>         case ETHTOOL_GRXCLSRLALL:
>                 for (i = 0; i < MVPP2_N_RFS_ENTRIES_PER_FLOW; i++) {
> +                       if (loc == info->rule_cnt) {
> +                               ret = -EMSGSIZE;
> +                               break;
> +                       }
> +
>                         if (port->rfs_rules[i])
>                                 rules[loc++] = i;
>                 }

Reviewed-by: Marcin Wojtas <mw@...ihalf.com>

Thanks,
Marcin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ