[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200418.131100.1675181599729717011.davem@davemloft.net>
Date: Sat, 18 Apr 2020 13:11:00 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: xiyuyang19@...an.edu.cn
Cc: ralf@...ux-mips.org, kuba@...nel.org, linux-hams@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
yuanxzhang@...an.edu.cn, kjlu@....edu, tanxin.ctf@...il.com
Subject: Re: [PATCH] net: netrom: Fix potential nr_neigh refcnt leak in
nr_add_node
From: Xiyu Yang <xiyuyang19@...an.edu.cn>
Date: Wed, 15 Apr 2020 16:36:19 +0800
> nr_add_node() invokes nr_neigh_get_dev(), which returns a local
> reference of the nr_neigh object to "nr_neigh" with increased refcnt.
>
> When nr_add_node() returns, "nr_neigh" becomes invalid, so the refcount
> should be decreased to keep refcount balanced.
>
> The issue happens in one normal path of nr_add_node(), which forgets to
> decrease the refcnt increased by nr_neigh_get_dev() and causes a refcnt
> leak. It should decrease the refcnt before the function returns like
> other normal paths do.
>
> Fix this issue by calling nr_neigh_put() before the nr_add_node()
> returns.
>
> Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
> Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
Applied and queued up for -stable, thanks.
Powered by blists - more mailing lists