fs/fuse kio: fix mapping dereference in a dead map

Submitted by Pavel Butsykin on Dec. 21, 2018, 12:34 p.m.

Details

Message ID 20181221123421.2900-1-pbutsykin@virtuozzo.com
State New
Series "fs/fuse kio: fix mapping dereference in a dead map"
Headers show

Commit Message

Pavel Butsykin Dec. 21, 2018, 12:34 p.m.
MAP_ARGS() contains reference to struct pcs_map_entry::mapping,
which can be NULL if map is dead.

#VSTOR-19267

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

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 817c7d6a9379..ad31d1222da3 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1175,7 +1175,8 @@  void pcs_map_complete(struct pcs_map_entry *m, struct pcs_ioc_getmap *omap)
 	return;
 
 error:
-	TRACE(" map error: %d for " MAP_FMT "\n", error.value, MAP_ARGS(m));
+	TRACE("map error: %d, m:%p, index:%lu, state:%x\n", error.value, m,
+		m->index, m->state);
 	BUG_ON(!pcs_if_error(&error));
 
 	m->state &= ~PCS_MAP_RESOLVING;

Comments

Kirill Tkhai Dec. 21, 2018, 2 p.m.
On 21.12.2018 15:34, Pavel Butsykin wrote:
> MAP_ARGS() contains reference to struct pcs_map_entry::mapping,
> which can be NULL if map is dead.
> 
> #VSTOR-19267
> 
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>

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

> ---
>  fs/fuse/kio/pcs/pcs_map.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
> index 817c7d6a9379..ad31d1222da3 100644
> --- a/fs/fuse/kio/pcs/pcs_map.c
> +++ b/fs/fuse/kio/pcs/pcs_map.c
> @@ -1175,7 +1175,8 @@ void pcs_map_complete(struct pcs_map_entry *m, struct pcs_ioc_getmap *omap)
>  	return;
>  
>  error:
> -	TRACE(" map error: %d for " MAP_FMT "\n", error.value, MAP_ARGS(m));
> +	TRACE("map error: %d, m:%p, index:%lu, state:%x\n", error.value, m,
> +		m->index, m->state);
>  	BUG_ON(!pcs_if_error(&error));
>  
>  	m->state &= ~PCS_MAP_RESOLVING;
>