Re: [f2fs-dev] [PATCH] f2fs: fix possible memory leak in f2fs_init_sysfs()
On 10/28, Chao Yu wrote: > Jaegeuk, > > There is a generic fix [1], let's drop this one... Ok, thanks. > > https://lore.kernel.org/lkml/20221025071549.1280528-1-yangyingli...@huawei.com/T/ > > On 2022/10/20 16:45, Chao Yu wrote: > > On 2022/10/18 15:32, Yang Yingliang wrote: > > > Inject fault while probing module, kset_register() may fail, > > > if it fails, but the refcount of kobject is not decreased to > > > 0, the name allocated in kobject_set_name() is leaked. Fix > > > this by calling kset_put(), so that name can be freed in > > > callback function kobject_cleanup(). > > > > > > unreferenced object 0x888101b7cc80 (size 8): > > > comm "modprobe", pid 252, jiffies 4294691378 (age 31.760s) > > > hex dump (first 8 bytes): > > > 66 32 66 73 00 88 ff ff f2fs > > > backtrace: > > > [<1db5b408>] __kmalloc_node_track_caller+0x44/0x1b0 > > > [<2783a073>] kstrdup+0x3a/0x70 > > > [] kstrdup_const+0x63/0x80 > > > [<3e5cf8f7>] kvasprintf_const+0x149/0x180 > > > [ ] kobject_set_name_vargs+0x56/0x150 > > > [<44611660>] kobject_set_name+0xab/0xe0 > > > > > > Fixes: bf9e697ecd42 ("f2fs: expose features to sysfs entry") > > > Signed-off-by: Yang Yingliang > > > > Reviewed-by: Chao Yu > > > > Thanks, > > > > > > ___ > > Linux-f2fs-devel mailing list > > Linux-f2fs-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] f2fs: fix possible memory leak in f2fs_init_sysfs()
Jaegeuk, There is a generic fix [1], let's drop this one... https://lore.kernel.org/lkml/20221025071549.1280528-1-yangyingli...@huawei.com/T/ On 2022/10/20 16:45, Chao Yu wrote: On 2022/10/18 15:32, Yang Yingliang wrote: Inject fault while probing module, kset_register() may fail, if it fails, but the refcount of kobject is not decreased to 0, the name allocated in kobject_set_name() is leaked. Fix this by calling kset_put(), so that name can be freed in callback function kobject_cleanup(). unreferenced object 0x888101b7cc80 (size 8): comm "modprobe", pid 252, jiffies 4294691378 (age 31.760s) hex dump (first 8 bytes): 66 32 66 73 00 88 ff ff f2fs backtrace: [<1db5b408>] __kmalloc_node_track_caller+0x44/0x1b0 [<2783a073>] kstrdup+0x3a/0x70 [] kstrdup_const+0x63/0x80 [<3e5cf8f7>] kvasprintf_const+0x149/0x180 [ ] kobject_set_name_vargs+0x56/0x150 [<44611660>] kobject_set_name+0xab/0xe0 Fixes: bf9e697ecd42 ("f2fs: expose features to sysfs entry") Signed-off-by: Yang Yingliang Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Re: [f2fs-dev] [PATCH] f2fs: fix possible memory leak in f2fs_init_sysfs()
On 2022/10/18 15:32, Yang Yingliang wrote: Inject fault while probing module, kset_register() may fail, if it fails, but the refcount of kobject is not decreased to 0, the name allocated in kobject_set_name() is leaked. Fix this by calling kset_put(), so that name can be freed in callback function kobject_cleanup(). unreferenced object 0x888101b7cc80 (size 8): comm "modprobe", pid 252, jiffies 4294691378 (age 31.760s) hex dump (first 8 bytes): 66 32 66 73 00 88 ff ff f2fs backtrace: [<1db5b408>] __kmalloc_node_track_caller+0x44/0x1b0 [<2783a073>] kstrdup+0x3a/0x70 [] kstrdup_const+0x63/0x80 [<3e5cf8f7>] kvasprintf_const+0x149/0x180 [ ] kobject_set_name_vargs+0x56/0x150 [<44611660>] kobject_set_name+0xab/0xe0 Fixes: bf9e697ecd42 ("f2fs: expose features to sysfs entry") Signed-off-by: Yang Yingliang Reviewed-by: Chao Yu Thanks, ___ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel