Messages in this thread | | | Date | Wed, 3 Nov 2021 16:27:10 -0700 | From | Jakub Kicinski <> | 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@huawei.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
| |