* [PATCH v1] bus/ifpga: fix issue of accessing null address
@ 2023-03-16 20:44 Wei Huang
2023-03-20 6:34 ` Zhang, Tianfei
2023-03-20 6:54 ` Xu, Rosen
0 siblings, 2 replies; 4+ messages in thread
From: Wei Huang @ 2023-03-16 20:44 UTC (permalink / raw)
To: dev, thomas, david.marchand
Cc: stable, rosen.xu, tianfei.zhang, qi.z.zhang, Wei Huang
In function ifpga_scan_one(), variable 'path' is NULL if device argument
'afu_bts' is not set, subsequent string copy with 'path' would lead to
segmentation fault.
Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")
Cc: stable@dpdk.org
Signed-off-by: Wei Huang <wei.huang@intel.com>
---
drivers/bus/ifpga/ifpga_bus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
index bb943b5..07e316b 100644
--- a/drivers/bus/ifpga/ifpga_bus.c
+++ b/drivers/bus/ifpga/ifpga_bus.c
@@ -135,6 +135,8 @@ struct rte_afu_device *
goto end;
}
afu_pr_conf.pr_enable = 1;
+ strlcpy(afu_pr_conf.bs_path, path,
+ sizeof(afu_pr_conf.bs_path));
} else {
afu_pr_conf.pr_enable = 0;
}
@@ -174,7 +176,6 @@ struct rte_afu_device *
rawdev->dev_ops->dev_start(rawdev))
goto end;
- strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
if (rawdev->dev_ops &&
rawdev->dev_ops->firmware_load &&
rawdev->dev_ops->firmware_load(rawdev,
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v1] bus/ifpga: fix issue of accessing null address
2023-03-16 20:44 [PATCH v1] bus/ifpga: fix issue of accessing null address Wei Huang
@ 2023-03-20 6:34 ` Zhang, Tianfei
2023-03-20 15:56 ` Thomas Monjalon
2023-03-20 6:54 ` Xu, Rosen
1 sibling, 1 reply; 4+ messages in thread
From: Zhang, Tianfei @ 2023-03-20 6:34 UTC (permalink / raw)
To: Huang, Wei, dev, thomas, david.marchand; +Cc: stable, Xu, Rosen, Zhang, Qi Z
> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Friday, March 17, 2023 4:44 AM
> To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com
> Cc: stable@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Huang, Wei
> <wei.huang@intel.com>
> Subject: [PATCH v1] bus/ifpga: fix issue of accessing null address
>
> In function ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is
> not set, subsequent string copy with 'path' would lead to segmentation fault.
>
> Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> ---
> drivers/bus/ifpga/ifpga_bus.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index
> bb943b5..07e316b 100644
> --- a/drivers/bus/ifpga/ifpga_bus.c
> +++ b/drivers/bus/ifpga/ifpga_bus.c
> @@ -135,6 +135,8 @@ struct rte_afu_device *
> goto end;
> }
> afu_pr_conf.pr_enable = 1;
> + strlcpy(afu_pr_conf.bs_path, path,
> + sizeof(afu_pr_conf.bs_path));
> } else {
> afu_pr_conf.pr_enable = 0;
> }
> @@ -174,7 +176,6 @@ struct rte_afu_device *
> rawdev->dev_ops->dev_start(rawdev))
> goto end;
>
> - strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
> if (rawdev->dev_ops &&
> rawdev->dev_ops->firmware_load &&
> rawdev->dev_ops->firmware_load(rawdev,
> --
> 1.8.3.1
It looks good for me.
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] bus/ifpga: fix issue of accessing null address
2023-03-20 6:34 ` Zhang, Tianfei
@ 2023-03-20 15:56 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2023-03-20 15:56 UTC (permalink / raw)
To: Huang, Wei
Cc: dev, david.marchand, stable, Xu, Rosen, Zhang, Qi Z, Zhang, Tianfei
> > In function ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is
> > not set, subsequent string copy with 'path' would lead to segmentation fault.
> >
> > Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wei Huang <wei.huang@intel.com>
>
> It looks good for me.
> Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v1] bus/ifpga: fix issue of accessing null address
2023-03-16 20:44 [PATCH v1] bus/ifpga: fix issue of accessing null address Wei Huang
2023-03-20 6:34 ` Zhang, Tianfei
@ 2023-03-20 6:54 ` Xu, Rosen
1 sibling, 0 replies; 4+ messages in thread
From: Xu, Rosen @ 2023-03-20 6:54 UTC (permalink / raw)
To: Huang, Wei, dev, thomas, david.marchand
Cc: stable, Zhang, Tianfei, Zhang, Qi Z
Hi,
> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Friday, March 17, 2023 4:44 AM
> To: dev@dpdk.org; thomas@monjalon.net; david.marchand@redhat.com
> Cc: stable@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Zhang, Tianfei
> <tianfei.zhang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Huang, Wei
> <wei.huang@intel.com>
> Subject: [PATCH v1] bus/ifpga: fix issue of accessing null address
>
> In function ifpga_scan_one(), variable 'path' is NULL if device argument
> 'afu_bts' is not set, subsequent string copy with 'path' would lead to
> segmentation fault.
>
> Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")
> Cc: stable@dpdk.org
>
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> ---
> drivers/bus/ifpga/ifpga_bus.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c
> index bb943b5..07e316b 100644
> --- a/drivers/bus/ifpga/ifpga_bus.c
> +++ b/drivers/bus/ifpga/ifpga_bus.c
> @@ -135,6 +135,8 @@ struct rte_afu_device *
> goto end;
> }
> afu_pr_conf.pr_enable = 1;
> + strlcpy(afu_pr_conf.bs_path, path,
> + sizeof(afu_pr_conf.bs_path));
> } else {
> afu_pr_conf.pr_enable = 0;
> }
> @@ -174,7 +176,6 @@ struct rte_afu_device *
> rawdev->dev_ops->dev_start(rawdev))
> goto end;
>
> - strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path));
> if (rawdev->dev_ops &&
> rawdev->dev_ops->firmware_load &&
> rawdev->dev_ops->firmware_load(rawdev,
> --
> 1.8.3.1
Acked-by: Rosen Xu <rosen.xu@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-20 15:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 20:44 [PATCH v1] bus/ifpga: fix issue of accessing null address Wei Huang
2023-03-20 6:34 ` Zhang, Tianfei
2023-03-20 15:56 ` Thomas Monjalon
2023-03-20 6:54 ` Xu, Rosen
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).