lkml.org 
[lkml]   [2021]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@huawei.com>

Reviewed-by: Jakub Kicinski <kuba@kernel.org>

\
 
 \ /
  Last update: 2021-11-04 00:28    [W:0.032 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site