[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211103162710.74755593@kicinski-fedora-PC1C0HJN>
Date: Wed, 3 Nov 2021 16:27:10 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Huang Guobin <huangguobin4@...wei.com>
Cc: <j.vosburgh@...il.com>, <vfalico@...il.com>, <andy@...yhouse.net>,
<davem@...emloft.net>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next v2] bonding: Fix a use-after-free problem when
bond_sysfs_slave_add() failed
On Tue, 2 Nov 2021 17:37:33 +0800 Huang Guobin wrote:
> When I do fuzz test for bonding device interface, I got the following
> use-after-free Calltrace:
> Put new_slave in bond_sysfs_slave_add() will cause use-after-free problems
> when new_slave is accessed in the subsequent error handling process. Since
> new_slave will be put in the subsequent error handling process, remove the
> unnecessary put to fix it.
> In addition, when sysfs_create_file() fails, if some files have been crea-
> ted successfully, we need to call sysfs_remove_file() to remove them.
> Since there are sysfs_create_files() & sysfs_remove_files() can be used,
> use these two functions instead.
>
> Fixes: 7afcaec49696 (bonding: use kobject_put instead of _del after kobject_add)
> Signed-off-by: Huang Guobin <huangguobin4@...wei.com>
Reviewed-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists