* [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL
@ 2017-08-24 7:12 Rongqiang XIE
2017-08-25 18:43 ` Patil, Harish
0 siblings, 1 reply; 3+ messages in thread
From: Rongqiang XIE @ 2017-08-24 7:12 UTC (permalink / raw)
To: rasesh.mody; +Cc: dev, Rongqiang XIE
In function qede_rss_reta_update(),the pointer params returned from
call to function rte_zmalloc() may be NULL and will be dereferenced.
So, should judge the params is NULL or not.
Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
---
drivers/net/qede/qede_ethdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0e05989..4e9e89f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2012,6 +2012,10 @@ int qede_rss_reta_update(struct rte_eth_dev *eth_dev,
memset(&vport_update_params, 0, sizeof(vport_update_params));
params = rte_zmalloc("qede_rss", sizeof(*params) * edev->num_hwfns,
RTE_CACHE_LINE_SIZE);
+ if (params == NULL) {
+ DP_ERR(edev, "failed to allocate memory\n");
+ return -ENOMEM;
+ }
for (i = 0; i < reta_size; i++) {
idx = i / RTE_RETA_GROUP_SIZE;
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL
2017-08-24 7:12 [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL Rongqiang XIE
@ 2017-08-25 18:43 ` Patil, Harish
2017-08-28 12:42 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Patil, Harish @ 2017-08-25 18:43 UTC (permalink / raw)
To: Rongqiang XIE, Mody, Rasesh; +Cc: dev
-----Original Message-----
From: dev <dev-bounces@dpdk.org> on behalf of Rongqiang XIE
<xie.rongqiang@zte.com.cn>
Date: Thursday, August 24, 2017 at 12:12 AM
To: "Mody, Rasesh" <Rasesh.Mody@cavium.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Rongqiang XIE <xie.rongqiang@zte.com.cn>
Subject: [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params
may NULL
>In function qede_rss_reta_update(),the pointer params returned from
>call to function rte_zmalloc() may be NULL and will be dereferenced.
>So, should judge the params is NULL or not.
>
>Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
>---
> drivers/net/qede/qede_ethdev.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
>diff --git a/drivers/net/qede/qede_ethdev.c
>b/drivers/net/qede/qede_ethdev.c
>index 0e05989..4e9e89f 100644
>--- a/drivers/net/qede/qede_ethdev.c
>+++ b/drivers/net/qede/qede_ethdev.c
>@@ -2012,6 +2012,10 @@ int qede_rss_reta_update(struct rte_eth_dev
>*eth_dev,
> memset(&vport_update_params, 0, sizeof(vport_update_params));
> params = rte_zmalloc("qede_rss", sizeof(*params) * edev->num_hwfns,
> RTE_CACHE_LINE_SIZE);
>+ if (params == NULL) {
>+ DP_ERR(edev, "failed to allocate memory\n");
>+ return -ENOMEM;
>+ }
>
> for (i = 0; i < reta_size; i++) {
> idx = i / RTE_RETA_GROUP_SIZE;
>--
>1.8.3.1
>
>
>Acked-by: Harish Patil <harish.patil@cavium.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL
2017-08-25 18:43 ` Patil, Harish
@ 2017-08-28 12:42 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-08-28 12:42 UTC (permalink / raw)
To: Patil, Harish, Rongqiang XIE, Mody, Rasesh; +Cc: dev
On 8/25/2017 7:43 PM, Patil, Harish wrote:
<..>>
> Subject: [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params
> may NULL
>
>> In function qede_rss_reta_update(),the pointer params returned from
>> call to function rte_zmalloc() may be NULL and will be dereferenced.
>> So, should judge the params is NULL or not.
Fixes: 8b3ee85efe11 ("net/qede: fix RSS table entries for 100G adapter")
Cc: stable@dpdk.org
>>
>> Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
>> Acked-by: Harish Patil <harish.patil@cavium.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-28 12:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24 7:12 [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL Rongqiang XIE
2017-08-25 18:43 ` Patil, Harish
2017-08-28 12:42 ` Ferruh Yigit
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).