pvcalls-front: fixes incorrect error handling
PATCH 1/1 pvcalls-front: fixes incorrect error handling
kfree() is incorrectly used to release the pages allocated by __get_free_page() and __get_free_pages(). Use the matching deallocators i.e., free_page() and free_pages(), respectively.
--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/pvcalls-front.c +2 -2
@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER ); +free_page ((unsigned long )map->active.ring);return ret; }
Signature · 1 line
2.7.4
Quoted 14 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/xen/pvcalls-front.c +0
-0
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 6 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );
Is map->active.data.in guaranteed to be NULL when entering this routine?
-boris
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 392
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 14 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/xen/pvcalls-front.c +0
-0
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 6 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );
Is map->active.data.in guaranteed to be NULL when entering this routine?
-boris
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?
I am not sure yet. Sorry for that. I observed the mismatches between __get_free_page and kfree, and submitted the patch.
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds __get_free_pages return value. If you agree, I will rewrite the patch.
Thanks,
Pan
Quoted 8 lines
-boris
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 392
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?
I am not sure yet. Sorry for that. I observed the mismatches between __get_free_page and kfree, and submitted the patch.
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds __get_free_pages return value. If you agree, I will rewrite the patch.
Thanks,
Pan
Quoted 8 lines
-boris
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
Stefano Stabellini
maintainerQuoted 25 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 13 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?
Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.
Like Boris said, map->active.ring and map->active.data.in are not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL and map->active.data.in can be NULL. However, free_pages and free_page should be able to cope with it, the same way that kfree is able to cope with it?
Quoted 8 lines
Quoted 7 lines
-boris
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
Quoted 27 lines · Stefano Stabellini
Quoted 26 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.
Quoted 8 lines
Quoted 3 lines
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
If map->active.data.in can be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).
-boris
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
-boris
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 392
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 27 lines · Stefano Stabellini
Quoted 26 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.
Quoted 8 lines
Quoted 3 lines
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
If map->active.data.in can be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).
-boris
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
-boris
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
Stefano Stabellini
maintainerQuoted 37 lines · Boris Ostrovsky
Quoted 27 lines · Stefano Stabellini
Quoted 26 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.Quoted 8 lines
Quoted 3 lines
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).
Why is it a problem? map->active.data.in and map->active.ring are only != NULL if they need to be freed. Otherwise, they are NULL. All structs are always initialized to zero. I don't think there are any issues.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
maintainerQuoted 37 lines · Boris Ostrovsky
Quoted 27 lines · Stefano Stabellini
Quoted 26 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.Quoted 8 lines
Quoted 3 lines
But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).
Why is it a problem? map->active.data.in and map->active.ring are only != NULL if they need to be freed. Otherwise, they are NULL. All structs are always initialized to zero. I don't think there are any issues.
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Boris Ostrovsky
Quoted 35 lines · Stefano Stabellini
Quoted 23 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
Quoted 6 lines
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).Why is it a problem?
map->active.data.inandmap->active.ringare only != NULL if they need to be freed. Otherwise, they are NULL.
That was my question --- I wasn't sure about it, and I read your previous message as if it was possible to be calling create_active() with map->active.data.in pointing somewhere non-NULL.
If it is NULL *upon entry* to calling_create() then Pan's original patch is fine.
-boris
Quoted 2 lines
All structs
are always initialized to zero. I don't think there are any issues.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Boris Ostrovsky
Quoted 35 lines · Stefano Stabellini
Quoted 23 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?
Quoted 6 lines
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).Why is it a problem?
map->active.data.inandmap->active.ringare only != NULL if they need to be freed. Otherwise, they are NULL.
That was my question --- I wasn't sure about it, and I read your previous message as if it was possible to be calling create_active() with map->active.data.in pointing somewhere non-NULL.
If it is NULL *upon entry* to calling_create() then Pan's original patch is fine.
-boris
Quoted 2 lines
All structs
are always initialized to zero. I don't think there are any issues.
Quoted 45 lines · Boris Ostrovsky
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Boris Ostrovsky
Quoted 35 lines · Stefano Stabellini
Quoted 23 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?Quoted 6 lines
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).Why is it a problem?
map->active.data.inandmap->active.ringare only != NULL if they need to be freed. Otherwise, they are NULL.
Quoted 6 lines
That was my question --- I wasn't sure about it, and I read your previous message as if it was possible to be calling
create_active()withmap->active.data.inpointing somewhere non-NULL.If it is NULL *upon entry* to
calling_create()then Pan's original patch is fine.
Right, I think it is fine too.
Quoted 3 lines
Quoted 2 lines
All structs
are always initialized to zero. I don't think there are any issues.
Quoted 45 lines · Boris Ostrovsky
Quoted 37 lines · Stefano Stabellini
Quoted 36 lines · Boris Ostrovsky
Quoted 35 lines · Stefano Stabellini
Quoted 23 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 12 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.Like Boris said,
map->active.ringandmap->active.data.inare not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL andmap->active.data.incan be NULL. However,free_pagesandfree_pageshould be able to cope with it, the same way that kfree is able to cope with it?Quoted 6 lines
Quoted 4 lines
If
map->active.data.incan be non-NULL on entry to this routine then I think this has been a problem all along. Pan's suggestion to use bytes for freeing is going to solve this (assuming bytes will be initialized to NULL).Why is it a problem?
map->active.data.inandmap->active.ringare only != NULL if they need to be freed. Otherwise, they are NULL.
Quoted 6 lines
That was my question --- I wasn't sure about it, and I read your previous message as if it was possible to be calling
create_active()withmap->active.data.inpointing somewhere non-NULL.If it is NULL *upon entry* to
calling_create()then Pan's original patch is fine.
Right, I think it is fine too.
Quoted 3 lines
Quoted 2 lines
All structs
are always initialized to zero. I don't think there are any issues.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Stefano Stabellini
maintainerQuoted 25 lines · PanBian
Quoted 10 lines · Boris Ostrovsky
Quoted 9 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>--- drivers/xen/pvcalls-front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 13 lines
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 388
Quoted 11 lines
drivers/xen/pvcalls-front.c +1
-2@@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn) out_error:if (*evtchn >=0 )xenbus_free_evtchn (pvcalls_front_dev, *evtchn); -kfree (map->active.data.in); -kfree (map->active.ring); +free_pages ((unsigned long )map->active.data.in,PVCALLS_RING_ORDER );Is
map->active.data.inguaranteed to be NULL when entering this routine?
Quoted 6 lines
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_pageand kfree, and submitted the patch.But I think your consideration is reasonable. A better solution is to directly free bytes, a local variable that holds
__get_free_pagesreturn value. If you agree, I will rewrite the patch.
Like Boris said, map->active.ring and map->active.data.in are not guaranteed to be NULL or != NULL here. For instance,map->active.ring can be != NULL and map->active.data.in can be NULL. However, free_pages and free_page should be able to cope with it, the same way that kfree is able to cope with it?
Quoted 8 lines
Quoted 7 lines
-boris
drivers/xen/pvcalls-front.c static int create_active(struct sock_mapping *map, int *evtchn) · line 392
Quoted 4 lines
drivers/xen/pvcalls-front.c +1
-0+free_page ((unsigned long )map->active.ring);return ret; }
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>
Pushed to xen/tip.git for-linus-4.20a
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Pan Bian
kfree()is incorrectly used to release the pages allocated by__get_free_page()and__get_free_pages(). Use the matching deallocators i.e.,free_page()andfree_pages(), respectively.Signed-off-by Pan Bian <[email protected]>
Pushed to xen/tip.git for-linus-4.20a
Juergen