fs/fuse kio: fix getting a non-existent pcs inode in kpcs_kill_requests()

Submitted by Pavel Butsykin on March 26, 2019, 10:57 a.m.

Details

Message ID 20190326105704.11700-1-pbutsykin@virtuozzo.com
State New
Series "fs/fuse kio: fix getting a non-existent pcs inode in kpcs_kill_requests()"
Headers show

Commit Message

Pavel Butsykin March 26, 2019, 10:57 a.m.
Some files may not have pcs inode, so it will be safer to check for !fi->private
before using it.

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 875ad18df4a7..a8c235244506 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1506,11 +1506,16 @@  static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode)
 
 	list_for_each_entry(ff, &fc->conn_files, fl) {
 		struct pcs_dentry_info *di;
+		struct fuse_inode *fi;
 
 		if (!ff->ff_dentry)
 			continue;
 
-		di = get_pcs_inode(ff->ff_dentry->d_inode);
+		fi = get_fuse_inode(ff->ff_dentry->d_inode);
+		if (!fi->private)
+			continue;
+
+		di = pcs_inode_from_fuse(fi);
 
 		spin_lock(&di->kq_lock);
 		fuse_kill_requests(fc, inode, &di->kq);

Comments

Kirill Tkhai March 28, 2019, 8:41 a.m.
On 26.03.2019 13:57, Pavel Butsykin wrote:
> Some files may not have pcs inode, so it will be safer to check for !fi->private
> before using it.
>> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>

> ---
>  fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> index 875ad18df4a7..a8c235244506 100644
> --- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> +++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> @@ -1506,11 +1506,16 @@ static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode)
>  
>  	list_for_each_entry(ff, &fc->conn_files, fl) {
>  		struct pcs_dentry_info *di;
> +		struct fuse_inode *fi;
>  
>  		if (!ff->ff_dentry)
>  			continue;
>  
> -		di = get_pcs_inode(ff->ff_dentry->d_inode);
> +		fi = get_fuse_inode(ff->ff_dentry->d_inode);
> +		if (!fi->private)
> +			continue;
> +
> +		di = pcs_inode_from_fuse(fi);
>  
>  		spin_lock(&di->kq_lock);
>  		fuse_kill_requests(fc, inode, &di->kq);
>
Alexey Kuznetsov March 28, 2019, 7:18 p.m.
Hello!

On Tue, Mar 26, 2019 at 1:57 PM Pavel Butsykin <pbutsykin@virtuozzo.com> wrote:
>
> Some files may not have pcs inode, so it will be safer to check for !fi->private
> before using it.
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>

Reviewed-by: Alexey Kuznetsov <kuznet@virtuozzo.com>