* [dpdk-dev] [PATCH] fbarray: fix init unlock without lock
@ 2019-03-29 10:57 Anatoly Burakov
2019-03-29 10:57 ` Anatoly Burakov
2019-03-29 11:50 ` Thomas Monjalon
0 siblings, 2 replies; 4+ messages in thread
From: Anatoly Burakov @ 2019-03-29 10:57 UTC (permalink / raw)
To: dev; +Cc: dariusz.stojaczyk, gavin.hu
Certain failure paths of rte_fbarray_init() will unlock the
mem area lock without locking it first. Fix this by properly
handling the failures.
Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index 0e7366e5e..f852c7f50 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -736,15 +736,19 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
}
page_sz = sysconf(_SC_PAGESIZE);
- if (page_sz == (size_t)-1)
- goto fail;
+ if (page_sz == (size_t)-1) {
+ free(ma);
+ return -1;
+ }
/* calculate our memory limits */
mmap_len = calc_data_size(page_sz, elt_sz, len);
data = eal_get_virtual_area(NULL, &mmap_len, page_sz, 0, 0);
- if (data == NULL)
- goto fail;
+ if (data == NULL) {
+ free(ma);
+ return -1;
+ }
rte_spinlock_lock(&mem_area_lock);
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] fbarray: fix init unlock without lock
2019-03-29 10:57 [dpdk-dev] [PATCH] fbarray: fix init unlock without lock Anatoly Burakov
@ 2019-03-29 10:57 ` Anatoly Burakov
2019-03-29 11:50 ` Thomas Monjalon
1 sibling, 0 replies; 4+ messages in thread
From: Anatoly Burakov @ 2019-03-29 10:57 UTC (permalink / raw)
To: dev; +Cc: dariusz.stojaczyk, gavin.hu
Certain failure paths of rte_fbarray_init() will unlock the
mem area lock without locking it first. Fix this by properly
handling the failures.
Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_eal/common/eal_common_fbarray.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c
index 0e7366e5e..f852c7f50 100644
--- a/lib/librte_eal/common/eal_common_fbarray.c
+++ b/lib/librte_eal/common/eal_common_fbarray.c
@@ -736,15 +736,19 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,
}
page_sz = sysconf(_SC_PAGESIZE);
- if (page_sz == (size_t)-1)
- goto fail;
+ if (page_sz == (size_t)-1) {
+ free(ma);
+ return -1;
+ }
/* calculate our memory limits */
mmap_len = calc_data_size(page_sz, elt_sz, len);
data = eal_get_virtual_area(NULL, &mmap_len, page_sz, 0, 0);
- if (data == NULL)
- goto fail;
+ if (data == NULL) {
+ free(ma);
+ return -1;
+ }
rte_spinlock_lock(&mem_area_lock);
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] fbarray: fix init unlock without lock
2019-03-29 10:57 [dpdk-dev] [PATCH] fbarray: fix init unlock without lock Anatoly Burakov
2019-03-29 10:57 ` Anatoly Burakov
@ 2019-03-29 11:50 ` Thomas Monjalon
2019-03-29 11:50 ` Thomas Monjalon
1 sibling, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2019-03-29 11:50 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dariusz.stojaczyk, gavin.hu
29/03/2019 11:57, Anatoly Burakov:
> Certain failure paths of rte_fbarray_init() will unlock the
> mem area lock without locking it first. Fix this by properly
> handling the failures.
>
> Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] fbarray: fix init unlock without lock
2019-03-29 11:50 ` Thomas Monjalon
@ 2019-03-29 11:50 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2019-03-29 11:50 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, dariusz.stojaczyk, gavin.hu
29/03/2019 11:57, Anatoly Burakov:
> Certain failure paths of rte_fbarray_init() will unlock the
> mem area lock without locking it first. Fix this by properly
> handling the failures.
>
> Fixes: 5b61c62cfd76 ("fbarray: add internal tailq for mapped areas")
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-03-29 11:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 10:57 [dpdk-dev] [PATCH] fbarray: fix init unlock without lock Anatoly Burakov
2019-03-29 10:57 ` Anatoly Burakov
2019-03-29 11:50 ` Thomas Monjalon
2019-03-29 11:50 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).