ubifs: ubifs_purge_xattrs() wrongly called

Sascha Hauer sha at pengutronix.de
Wed Jan 20 08:38:47 EST 2021


Hi All,

I just noticed that ubifs_purge_xattrs() is wrongly called from
ubifs_unlink() when a dentry is deleted. Deleting a dentry doesn't mean
that the inode the xattrs are attached to is going away. Removing a file
that has hardlinks will result in removing the xattrs when instead they
should stay until the last link is removed.

ubifs_purge_xattrs() only removes the xattrs when their number exceeds
ubifs_xattr_max_cnt(). Otherwise it does nothing, so it's unlikely to
hit this bug in real life.

I am not sure how to fix that. Maybe calling ubifs_purge_xattrs() from
ubifs_evict_inode() would be correct, but I haven't looked deeper into
this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-mtd mailing list