DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] vdpa/sfc: fix null pointer dereference
@ 2022-01-29 17:30 Weiguo Li
  2022-02-04 11:56 ` Weiguo Li
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Weiguo Li @ 2022-01-29 17:30 UTC (permalink / raw)
  To: vsrivast; +Cc: dev

When sva is null, sfc_vdpa_info(sva, ...) will cause a null
dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that.
See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG
defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail.

Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/vdpa/sfc/sfc_vdpa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/sfc/sfc_vdpa.c b/drivers/vdpa/sfc/sfc_vdpa.c
index fccdd8c687..53f598facc 100644
--- a/drivers/vdpa/sfc/sfc_vdpa.c
+++ b/drivers/vdpa/sfc/sfc_vdpa.c
@@ -328,7 +328,8 @@ sfc_vdpa_pci_remove(struct rte_pci_device *pci_dev)
 
 	sva = sfc_vdpa_get_adapter_by_dev(pci_dev);
 	if (sva == NULL) {
-		sfc_vdpa_info(sva, "invalid device: %s", pci_dev->name);
+		SFC_VDPA_GENERIC_LOG(INFO,
+			"Invalid device: %s.", pci_dev->name);
 		return -1;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE:[PATCH] vdpa/sfc: fix null pointer dereference
  2022-01-29 17:30 [PATCH] vdpa/sfc: fix null pointer dereference Weiguo Li
@ 2022-02-04 11:56 ` Weiguo Li
  2022-02-10 14:37   ` [PATCH] " Maxime Coquelin
  2022-02-10 15:11 ` Maxime Coquelin
  2022-02-10 15:12 ` Maxime Coquelin
  2 siblings, 1 reply; 5+ messages in thread
From: Weiguo Li @ 2022-02-04 11:56 UTC (permalink / raw)
  To: vsrivast; +Cc: maxime.coquelin, dev

The macro sfc_vdpa_info(sva, ...) will invoke sva->logtype_main, 
It'll trigger a NULL dereference when sva is NULL.

This patch fix it.

BTW this patch is not superseded by another one:
 [v2] vdpa/sfc: fix null dereference
 (http://dpdk.org/patch/106720)

They looks alike in title, but deal with different files.

Please don't tag me as superseded again :)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vdpa/sfc: fix null pointer dereference
  2022-02-04 11:56 ` Weiguo Li
@ 2022-02-10 14:37   ` Maxime Coquelin
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2022-02-10 14:37 UTC (permalink / raw)
  To: Weiguo Li, vsrivast; +Cc: dev

Hi,

On 2/4/22 12:56, Weiguo Li wrote:
> The macro sfc_vdpa_info(sva, ...) will invoke sva->logtype_main,
> It'll trigger a NULL dereference when sva is NULL.
> 
> This patch fix it.
> 
> BTW this patch is not superseded by another one:
>   [v2] vdpa/sfc: fix null dereference
>   (http://dpdk.org/patch/106720)
> 
> They looks alike in title, but deal with different files.
> 
> Please don't tag me as superseded again :)
> 

Got it, having commit titles being more specific would help to avoid
that! :)

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vdpa/sfc: fix null pointer dereference
  2022-01-29 17:30 [PATCH] vdpa/sfc: fix null pointer dereference Weiguo Li
  2022-02-04 11:56 ` Weiguo Li
@ 2022-02-10 15:11 ` Maxime Coquelin
  2022-02-10 15:12 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2022-02-10 15:11 UTC (permalink / raw)
  To: Weiguo Li, vsrivast; +Cc: dev



On 1/29/22 18:30, Weiguo Li wrote:
> When sva is null, sfc_vdpa_info(sva, ...) will cause a null
> dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that.
> See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG
> defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail.
> 
> Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
>   drivers/vdpa/sfc/sfc_vdpa.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/sfc/sfc_vdpa.c b/drivers/vdpa/sfc/sfc_vdpa.c
> index fccdd8c687..53f598facc 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa.c
> @@ -328,7 +328,8 @@ sfc_vdpa_pci_remove(struct rte_pci_device *pci_dev)
>   
>   	sva = sfc_vdpa_get_adapter_by_dev(pci_dev);
>   	if (sva == NULL) {
> -		sfc_vdpa_info(sva, "invalid device: %s", pci_dev->name);
> +		SFC_VDPA_GENERIC_LOG(INFO,
> +			"Invalid device: %s.", pci_dev->name);
>   		return -1;
>   	}
>   

Applied to dpdk-next-virtio/main, with rewording the title and cc'ing
stable.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vdpa/sfc: fix null pointer dereference
  2022-01-29 17:30 [PATCH] vdpa/sfc: fix null pointer dereference Weiguo Li
  2022-02-04 11:56 ` Weiguo Li
  2022-02-10 15:11 ` Maxime Coquelin
@ 2022-02-10 15:12 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2022-02-10 15:12 UTC (permalink / raw)
  To: Weiguo Li, vsrivast; +Cc: dev



On 1/29/22 18:30, Weiguo Li wrote:
> When sva is null, sfc_vdpa_info(sva, ...) will cause a null
> dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that.
> See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG
> defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail.
> 
> Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
>   drivers/vdpa/sfc/sfc_vdpa.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vdpa/sfc/sfc_vdpa.c b/drivers/vdpa/sfc/sfc_vdpa.c
> index fccdd8c687..53f598facc 100644
> --- a/drivers/vdpa/sfc/sfc_vdpa.c
> +++ b/drivers/vdpa/sfc/sfc_vdpa.c
> @@ -328,7 +328,8 @@ sfc_vdpa_pci_remove(struct rte_pci_device *pci_dev)
>   
>   	sva = sfc_vdpa_get_adapter_by_dev(pci_dev);
>   	if (sva == NULL) {
> -		sfc_vdpa_info(sva, "invalid device: %s", pci_dev->name);
> +		SFC_VDPA_GENERIC_LOG(INFO,
> +			"Invalid device: %s.", pci_dev->name);
>   		return -1;
>   	}
>   

Applied to dpdk-next-virtio/main.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-10 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-29 17:30 [PATCH] vdpa/sfc: fix null pointer dereference Weiguo Li
2022-02-04 11:56 ` Weiguo Li
2022-02-10 14:37   ` [PATCH] " Maxime Coquelin
2022-02-10 15:11 ` Maxime Coquelin
2022-02-10 15:12 ` Maxime Coquelin

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).