diff mbox

[RESEND] vfs: show_vfsstat: do not ignore errors from show_devname method

Message ID 20151118174248.GA13411@altlinux.org (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry V. Levin Nov. 18, 2015, 5:42 p.m. UTC
Date: Thu, 19 Mar 2015 11:10:54 +0000

Explicitly check show_devname method return code and bail out in case
of an error.  This fixes regression introduced by commit 9d4d65748a5c.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
---
 fs/proc_namespace.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mateusz Guzik Nov. 18, 2015, 6:02 p.m. UTC | #1
On Wed, Nov 18, 2015 at 08:42:48PM +0300, Dmitry V. Levin wrote:
> Date: Thu, 19 Mar 2015 11:10:54 +0000
> 
> Explicitly check show_devname method return code and bail out in case
> of an error.  This fixes regression introduced by commit 9d4d65748a5c.
> 
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  fs/proc_namespace.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
> index 8ebd9a3..876459559 100644
> --- a/fs/proc_namespace.c
> +++ b/fs/proc_namespace.c
> @@ -197,17 +197,19 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
>  	if (sb->s_op->show_devname) {
>  		seq_puts(m, "device ");
>  		err = sb->s_op->show_devname(m, mnt_path.dentry);
> +		if (err)
> +			goto out;
>  	} else {
>  		if (r->mnt_devname) {
>  			seq_puts(m, "device ");
>  			mangle(m, r->mnt_devname);
>  		} else
>  			seq_puts(m, "no device");
>  	}
>  
>  	/* mount point */
>  	seq_puts(m, " mounted on ");
>  	/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
>  	err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
>  	if (err)
>  		goto out;
> 

I would suggest this should also remove now spurious initialization of
err to 0 and now always-true !err check prior to calling ->show_stats.
diff mbox

Patch

diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8ebd9a3..876459559 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -197,17 +197,19 @@  static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
 	if (sb->s_op->show_devname) {
 		seq_puts(m, "device ");
 		err = sb->s_op->show_devname(m, mnt_path.dentry);
+		if (err)
+			goto out;
 	} else {
 		if (r->mnt_devname) {
 			seq_puts(m, "device ");
 			mangle(m, r->mnt_devname);
 		} else
 			seq_puts(m, "no device");
 	}
 
 	/* mount point */
 	seq_puts(m, " mounted on ");
 	/* mountpoints outside of chroot jail will give SEQ_SKIP on this */
 	err = seq_path_root(m, &mnt_path, &p->root, " \t\n\\");
 	if (err)
 		goto out;