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  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]
Date:   Sun, 27 Dec 2020 09:13:46 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Dinghao Liu <dinghao.liu@....edu.cn>
Cc:     kjlu@....edu, Doug Ledford <dledford@...hat.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Ursula Braun <ubraun@...ux.ibm.com>,
        HÃ¥kon Bugge <haakon.bugge@...cle.com>,
        Divya Indi <divya.indi@...cle.com>,
        Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/sa: Fix memleak in ib_nl_make_request

On Sun, Dec 20, 2020 at 04:13:14PM +0800, Dinghao Liu wrote:
> When rdma_nl_multicast() fails, skb should be freed
> just like when ibnl_put_msg() fails.

It is not so simple as you wrote in the description.

There are no other places in the linux kernel that free
SKBs after netlink_multicast() failure.

Thanks

>
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
> ---
>  drivers/infiniband/core/sa_query.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
> index 89a831fa1885..8bd23b5cc913 100644
> --- a/drivers/infiniband/core/sa_query.c
> +++ b/drivers/infiniband/core/sa_query.c
> @@ -873,8 +873,10 @@ static int ib_nl_make_request(struct ib_sa_query *query, gfp_t gfp_mask)
>  	spin_lock_irqsave(&ib_nl_request_lock, flags);
>  	ret = rdma_nl_multicast(&init_net, skb, RDMA_NL_GROUP_LS, gfp_flag);
>
> -	if (ret)
> +	if (ret) {
> +		nlmsg_free(skb);
>  		goto out;
> +	}
>
>  	/* Put the request on the list.*/
>  	delay = msecs_to_jiffies(sa_local_svc_timeout_ms);
> --
> 2.17.1
>

Powered by blists - more mailing lists