Commit b635f2e
f2fs: fix uninitialized kobject put in f2fs_init_sysfs()
In f2fs_init_sysfs(), all failure paths after kset_register() jump to
put_kobject, which unconditionally releases both f2fs_tune and
f2fs_feat.
If kobject_init_and_add(&f2fs_feat, ...) fails, f2fs_tune has not been
initialized yet, so calling kobject_put(&f2fs_tune) is invalid.
Fix this by splitting the unwind path so each error path only releases
objects that were successfully initialized.
Fixes: a907f3a ("f2fs: add a sysfs entry to reclaim POSIX_FADV_NOREUSE pages")
Cc: [email protected]
Signed-off-by: Guangshuo Li <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>1 parent 5909bed commit b635f2e
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1997 | 1997 | | |
1998 | 1998 | | |
1999 | 1999 | | |
2000 | | - | |
| 2000 | + | |
2001 | 2001 | | |
2002 | 2002 | | |
2003 | 2003 | | |
2004 | 2004 | | |
2005 | | - | |
| 2005 | + | |
2006 | 2006 | | |
2007 | 2007 | | |
2008 | 2008 | | |
2009 | 2009 | | |
2010 | | - | |
| 2010 | + | |
2011 | 2011 | | |
2012 | 2012 | | |
2013 | 2013 | | |
2014 | 2014 | | |
2015 | | - | |
| 2015 | + | |
2016 | 2016 | | |
| 2017 | + | |
2017 | 2018 | | |
| 2019 | + | |
2018 | 2020 | | |
2019 | 2021 | | |
2020 | 2022 | | |
| |||
0 commit comments