Commit 759c361e authored by Djalal Harouni's avatar Djalal Harouni Committed by Al Viro

fs/ncpfs: fix error paths and goto statements in ncp_fill_super()

The label 'out_bdi' should be followed by bdi_destroy() instead of
fput() which should be after the 'out_fput' label.

If bdi_setup_and_register() fails then jump to the 'out_fput' label
instead of the 'out_bdi' one.

If fget(data.info_fd) fails then jump to the previously fixed 'out_bdi'
label to call bdi_destroy() otherwise the bdi object will not be
destroyed.

Compile tested only.
Signed-off-by: default avatarDjalal Harouni <tixxdz@opendz.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 7c6455e3
...@@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -548,7 +548,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY); error = bdi_setup_and_register(&server->bdi, "ncpfs", BDI_CAP_MAP_COPY);
if (error) if (error)
goto out_bdi; goto out_fput;
server->ncp_filp = ncp_filp; server->ncp_filp = ncp_filp;
server->ncp_sock = sock; server->ncp_sock = sock;
...@@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -559,7 +559,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
error = -EBADF; error = -EBADF;
server->info_filp = fget(data.info_fd); server->info_filp = fget(data.info_fd);
if (!server->info_filp) if (!server->info_filp)
goto out_fput; goto out_bdi;
error = -ENOTSOCK; error = -ENOTSOCK;
sock_inode = server->info_filp->f_path.dentry->d_inode; sock_inode = server->info_filp->f_path.dentry->d_inode;
if (!S_ISSOCK(sock_inode->i_mode)) if (!S_ISSOCK(sock_inode->i_mode))
...@@ -746,9 +746,9 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -746,9 +746,9 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
out_fput2: out_fput2:
if (server->info_filp) if (server->info_filp)
fput(server->info_filp); fput(server->info_filp);
out_fput:
bdi_destroy(&server->bdi);
out_bdi: out_bdi:
bdi_destroy(&server->bdi);
out_fput:
/* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: /* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>:
* *
* The previously used put_filp(ncp_filp); was bogus, since * The previously used put_filp(ncp_filp); was bogus, since
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment