Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp8250394pxu; Sat, 26 Dec 2020 23:18:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwA6bVM5roRZsGWzVVIQk8rAbwi/8mKd5KJ0NbdPLqulJvktMBH4CqT4GPscISzan7kXqCL X-Received: by 2002:a17:906:26d7:: with SMTP id u23mr26987715ejc.210.1609053531845; Sat, 26 Dec 2020 23:18:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609053531; cv=none; d=google.com; s=arc-20160816; b=Id07jTIrDt8Ew0jvLQcWHEVKlzfDrFmDDKmih/GEtVyvPlFYJr7uWSSDrlyPFmjQ83 cWA5JM8ePOMaBcsRbYuq5axq0icgg9azkvwEHiVnOKks5nEUf2aIpZG/Afy/afTGRRlo sYOocRtu8iQzVm2C3AXHyhMzasSNVhBVnpwf0SM3LWXgkQVaaVwkAfZ1UFhZAm1Maz8F gvZKoqb91K9Fce6xt2n8xjZlFk9I7Ht9cxgFjEOGoELgWYeEwa1gG88YiBnBm+pXsgq3 XixRrKF+cgju3TKERJoz66FsXyGgQhnbjIhT8Jbh2rdjRBSqq8q4xrFftyF70PgFe1UP EuOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AcaejWFpdqW/omibAYbCPhPB2Vadv+m4FJng3pXLlcQ=; b=VBq6Tn/TpIkRjs9Qgz4COLGm3215FcW05T8Dev7IjtjuID6gV1FhTQ/+7OcFKGz2Wb Kh9SWG9mVoDqO1t206XCEPCwctcBkyV2CeRzZqO7W6xktWpocapeqPAAf3f3IoP1ujka wE/s5BSFK1MC6ibp2ybq9D8bFG6rZ99gxgy3sp+/Kk8vCedDXbcQIRk1wk0r9geqZdQz IRSUgJxwRNKSMVTEw2hspAyIUvNVVmNNrsS68ZZC9Bkj+dyTFAj+hMIUXL4Zbq8mG+JA hwhBkRW84snf23HKCdEmQ3f1UJPeE+suEfRAxfOtQoC/Sik58lX4+eYHaiDq3AOHk6Vq YU/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CzPS3bm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m17si16865266ejn.194.2020.12.26.23.18.11; Sat, 26 Dec 2020 23:18:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CzPS3bm6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726070AbgL0HOb (ORCPT + 99 others); Sun, 27 Dec 2020 02:14:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:60730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbgL0HOb (ORCPT ); Sun, 27 Dec 2020 02:14:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1EFDE207F7; Sun, 27 Dec 2020 07:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609053230; bh=wYfU/khwimF4RK5SPumvGDlK/392P/6YdLUMLsIFrl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CzPS3bm6Kh3vsKNSIDx1JuSwDVj63fscgWXK/egR8GJI62/H6frpMlt1CQKPj7yiX B9q2TY4XlVdG4YO3mmOywqyQhfBjNvOlu0fBLIsSfUkgx9ucaUCNBLeHt6A84j+F3E SfsT6ujTZa6q2PASHsfaYvs7PnVV7OKJgtX0jbJvFTonTL3EgpItuWNx4WRv2y0v7w y/1qiL2npnIOCwgPIVZRdHp2NRAnE6VCtK8IeDg5u1+xxToEKkoWwH88pRr8DYx1vb KT+K8z+V1X5zshgZdoe3ZqbOJwaqlgfmUOhkSl7ihCr4LuL4Hmwk7933wczmp+tcAO snV1GgNNHRxkA== Date: Sun, 27 Dec 2020 09:13:46 +0200 From: Leon Romanovsky To: Dinghao Liu Cc: kjlu@umn.edu, Doug Ledford , Jason Gunthorpe , "Gustavo A. R. Silva" , Ursula Braun , =?iso-8859-1?Q?H=E5kon?= Bugge , Divya Indi , Mauro Carvalho Chehab , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/sa: Fix memleak in ib_nl_make_request Message-ID: <20201227071346.GB4457@unreal> References: <20201220081317.18728-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201220081317.18728-1-dinghao.liu@zju.edu.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 >