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] [day] [month] [year] [list]
Message-ID: <CAAa=b7dk37o-z=XNTCFOFMuR=G1_ig1bv+YRJaNwJSkgfQTVPw@mail.gmail.com>
Date:   Mon, 12 Aug 2019 10:36:44 -0400
From:   Wenwen Wang <wenwen@...uga.edu>
To:     Tariq Toukan <tariqt@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        "open list:MELLANOX ETHERNET DRIVER (mlx4_en)" 
        <netdev@...r.kernel.org>,
        "open list:MELLANOX MLX4 core VPI driver" 
        <linux-rdma@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        Wenwen Wang <wenwen@...uga.edu>
Subject: Re: [PATCH] net/mlx4_en: fix a memory leak bug

On Mon, Aug 12, 2019 at 5:05 AM Tariq Toukan <tariqt@...lanox.com> wrote:
>
> Hi Wenwen,
>
> Thanks for your patch.
>
> On 8/12/2019 9:36 AM, Wenwen Wang wrote:
> > In mlx4_en_config_rss_steer(), 'rss_map->indir_qp' is allocated through
> > kzalloc(). After that, mlx4_qp_alloc() is invoked to configure RSS
> > indirection. However, if mlx4_qp_alloc() fails, the allocated
> > 'rss_map->indir_qp' is not deallocated, leading to a memory leak bug.
> >
> > To fix the above issue, add the 'mlx4_err' label to free
> > 'rss_map->indir_qp'.
> >
>
> Add a Fixes line.
>
> > Signed-off-by: Wenwen Wang <wenwen@...uga.edu> > ---
> >   drivers/net/ethernet/mellanox/mlx4/en_rx.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> > index 6c01314..9476dbd 100644
> > --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> > @@ -1187,7 +1187,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
> >       err = mlx4_qp_alloc(mdev->dev, priv->base_qpn, rss_map->indir_qp);
> >       if (err) {
> >               en_err(priv, "Failed to allocate RSS indirection QP\n");
> > -             goto rss_err;
> > +             goto mlx4_err;
> >       }
> >
> >       rss_map->indir_qp->event = mlx4_en_sqp_event;
> > @@ -1241,6 +1241,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
> >                      MLX4_QP_STATE_RST, NULL, 0, 0, rss_map->indir_qp);
> >       mlx4_qp_remove(mdev->dev, rss_map->indir_qp);
> >       mlx4_qp_free(mdev->dev, rss_map->indir_qp);
> > +mlx4_err:
>
> I don't like the label name. It's too general and not informative.
> Maybe qp_alloc_err?

Thanks! I will rework the patch.

Wenwen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ