Skip to contentSkip to conversation

ovl: Pass ovl_get_nlink() parameters in right order

PATCH Superseded Vivek Goyal 3 participants 3 messages Nov 27, 2017 – Dec 7, 2017 Overlay filesystem

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovl: Pass ovl_get_nlink() parameters in right order

Hi Amir,

I am wondering if this is a bug or it is supposed to be like this. I felt it is a bug, so I generated a patch and sending it for your review.

Vivek

Right now we seem to be passing index as "lowerdentry" and origin.dentry as "upperdentry". IIUC, we should pass these parameters in reversed order and this looks like a bug.

---
 fs/overlayfs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/namei.c +1 -1
index 625ed8066570..5ef69bc09e0c 100644
@@ -435,7 +435,7 @@ int ovl_verify_index(struct dentry *index, struct ovl_path *lower,
 
 	/* Check if index is orphan and don't warn before cleaning it */
 	if (d_inode(index)->i_nlink == 1 &&
-	    ovl_get_nlink(index, origin.dentry, 0) == 0)
+	    ovl_get_nlink(origin.dentry, index, 0) == 0)
 		err = -ENOENT;
 
 	dput(origin.dentry);
maintainer
#1 lore raw
Quoted 5 lines · Vivek Goyal

Hi Amir,

I am wondering if this is a bug or it is supposed to be like this. I felt it is a bug, so I generated a patch and sending it for your review.

Yap. That's a bug. Good catch!
I fixed test overlay/033 to catch it.

Please add cc:stable # v4.13 and Fixes tag.

Thanks!
Amir.

Quoted 25 lines

Vivek

Right now we seem to be passing index as "lowerdentry" and origin.dentry as "upperdentry". IIUC, we should pass these parameters in reversed order and this looks like a bug.

---
 fs/overlayfs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/namei.c +1 -1
index 625ed8066570..5ef69bc09e0c 100644
@@ -435,7 +435,7 @@ int ovl_verify_index(struct dentry *index, struct ovl_path *lower,
 
        /* Check if index is orphan and don't warn before cleaning it */
        if (d_inode(index)->i_nlink == 1 &&
-           ovl_get_nlink(index, origin.dentry, 0) == 0)
+           ovl_get_nlink(origin.dentry, index, 0) == 0)
                err = -ENOENT;
 
        dput(origin.dentry);
maintainer
#2 lore raw
Quoted 11 lines · Amir Goldstein
Quoted 5 lines · Vivek Goyal

Hi Amir,

I am wondering if this is a bug or it is supposed to be like this. I felt it is a bug, so I generated a patch and sending it for your review.

Yap. That's a bug. Good catch!
I fixed test overlay/033 to catch it.

Please add cc:stable # v4.13 and Fixes tag.

Thanks Vivek. Added the stable and fixes tags and taken the above as an Acked-by from Amir.

Thanks,
Miklos