Re: [PATCH v2] lsm: don't call d_path() when current->fs is NULL

From: Drif Abdelmalek Mohamed Said

Date: Sat Nov 21 2026 - 05:08:47 EST


Hello Paul,
Thanks for the reply,

> static void audit_log_lsm_path(ab, inode, path)
> {
> if (current->fs)
> audit_log_d_path(...);
> else if (inode)
> audit_log_lsm_inode(ab, inode)
> else
> audit_log_format(ab, " path=?");
> }

I got your intention in your v1's reply, but i think that changes the current behaviour,
if current->fs is not NULL, then this would only log path, without inode, whereas current
code for example here:

case LSM_AUDIT_DATA_PATH: {
struct inode *inode;

audit_log_d_path(ab, " path=", &a->u.path);

inode = d_backing_inode(a->u.path.dentry);
if (inode) {
audit_log_format(ab, " dev=");
audit_log_untrustedstring(ab, inode->i_sb->s_id);
audit_log_format(ab, " ino=%llu", inode->i_ino);
}
break;
}

if path is logged, and most probably also inode, and your suggested change only logs one of them,
Is that intentional, or am i not getting something right?
In either case, i would happily send v3 with suggested change.

Cordially,