Commit 7b5ab04
timekeeping: Fix resource leak in tk_aux_sysfs_init() error paths
tk_aux_sysfs_init() returns immediately on error during the auxiliary clock
initialization loop without cleaning up previously allocated kobjects and
sysfs groups.
If kobject_create_and_add() or sysfs_create_group() fails during loop
iteration, the parent kobjects (tko and auxo) and any previously created
child kobjects are leaked.
Fix this by adding proper error handling with goto labels to ensure all
allocated resources are cleaned up on failure. kobject_put() on the
parent kobjects will handle cleanup of their children.
Fixes: 7b95663 ("timekeeping: Provide interface to control auxiliary clocks")
Signed-off-by: Malaya Kumar Rout <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://patch.msgid.link/[email protected]1 parent 807e0d1 commit 7b5ab04
1 file changed
+12
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3060 | 3060 | | |
3061 | 3061 | | |
3062 | 3062 | | |
| 3063 | + | |
3063 | 3064 | | |
3064 | 3065 | | |
3065 | | - | |
| 3066 | + | |
3066 | 3067 | | |
3067 | 3068 | | |
3068 | | - | |
3069 | | - | |
3070 | | - | |
3071 | | - | |
| 3069 | + | |
| 3070 | + | |
3072 | 3071 | | |
3073 | 3072 | | |
3074 | 3073 | | |
3075 | 3074 | | |
3076 | 3075 | | |
3077 | 3076 | | |
3078 | | - | |
3079 | | - | |
3080 | | - | |
| 3077 | + | |
3081 | 3078 | | |
| 3079 | + | |
3082 | 3080 | | |
3083 | | - | |
| 3081 | + | |
3084 | 3082 | | |
3085 | 3083 | | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
3086 | 3089 | | |
3087 | 3090 | | |
3088 | 3091 | | |
| |||
0 commit comments