RE: Re: [PATCH 1/1] Fix memory leak in kernfs_security_xattr_set and kernfs_security_xattr_set

From: CHANDAN VN
Date: Fri Jun 01 2018 - 12:29:27 EST



>>ÂIÂagreeÂthatÂtheÂfixÂcanÂbeÂdoneÂsimplyÂbyÂusingÂ"false"ÂforÂ
>>Âsmack_inode_getsecurity(),ÂbutÂwhatÂhappensÂwithÂkernfs_node_setsecdata()
>>ÂandÂsmack_inode_notifysecctx().Âkernfs_node_setsecdata()ÂisÂprobablyÂignorable
>>ÂbutÂsmack_inode_notifysecctx()ÂisÂsendingÂtheÂ"ctx"ÂtoÂsmack_inode_setsecurity()
>>ÂandÂsinceÂ"ctx"ÂwouldÂbeÂNULLÂbecauseÂweÂusedÂ"false",Âsmack_inode_setsecurity()
>>ÂbecomesÂdummy.
Â
>ThankÂyouÂforÂpointingÂthisÂout.ÂYou'reÂright,Âthere'sÂmore
>atÂissueÂhereÂthanÂchangingÂtheÂallocÂflagÂwillÂfix.ÂIÂthink
>thatÂcallingÂsmack_inode_getsecurity()ÂfromÂsmack_inode_getsecctx()
>isÂmakingÂtheÂcodeÂmoreÂcomplicatedÂthanÂitÂneedsÂtoÂbe.ÂIÂwill
>haveÂaÂpatchÂshortly.

If you think the patch would take time or is complicated, I suggest that the kfree() fix should go
to fix the leaks for now.Â
Â
Â
Â