vhost: fix null pointer dereference

Message ID tencent_40637878FE4E8922D4749CBF0F466045EE09@qq.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: fix null pointer dereference |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing warning apply patch failure
ci/intel-Testing success Testing PASS

Commit Message

Weiguo Li Jan. 29, 2022, 7:07 p.m. UTC
  Fixes: 155ee3542fb1 ("vhost: improve vhost-user layer logs")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 lib/vhost/vhost_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Maxime Coquelin Feb. 3, 2022, 1:49 p.m. UTC | #1
On 1/29/22 20:07, Weiguo Li wrote:
> Fixes: 155ee3542fb1 ("vhost: improve vhost-user layer logs")
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
>   lib/vhost/vhost_user.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index e8297a09eb..d032998488 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -671,7 +671,7 @@ numa_realloc(struct virtio_net *dev, int index)
>   	dev = rte_realloc_socket(old_dev, sizeof(*dev), 0, node);
>   	if (!dev) {
>   		VHOST_LOG_CONFIG(ERR, "(%s) failed to realloc dev on node %d\n",
> -				dev->ifname, node);
> +				old_dev->ifname, node);
>   		return old_dev;
>   	}
>   

Thanks for the fix.

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

Thanks,
Maxime
  
Maxime Coquelin Feb. 10, 2022, 9:23 p.m. UTC | #2
On 1/29/22 20:07, Weiguo Li wrote:
> Fixes: 155ee3542fb1 ("vhost: improve vhost-user layer logs")
> 
> Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> ---
>   lib/vhost/vhost_user.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
> index e8297a09eb..d032998488 100644
> --- a/lib/vhost/vhost_user.c
> +++ b/lib/vhost/vhost_user.c
> @@ -671,7 +671,7 @@ numa_realloc(struct virtio_net *dev, int index)
>   	dev = rte_realloc_socket(old_dev, sizeof(*dev), 0, node);
>   	if (!dev) {
>   		VHOST_LOG_CONFIG(ERR, "(%s) failed to realloc dev on node %d\n",
> -				dev->ifname, node);
> +				old_dev->ifname, node);
>   		return old_dev;
>   	}
>   


Applied to dpdk-next-virtio/main.

Thanks,
Maxime
  

Patch

diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index e8297a09eb..d032998488 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -671,7 +671,7 @@  numa_realloc(struct virtio_net *dev, int index)
 	dev = rte_realloc_socket(old_dev, sizeof(*dev), 0, node);
 	if (!dev) {
 		VHOST_LOG_CONFIG(ERR, "(%s) failed to realloc dev on node %d\n",
-				dev->ifname, node);
+				old_dev->ifname, node);
 		return old_dev;
 	}