All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-08  9:32 ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-08  9:32 UTC (permalink / raw)
  To: Michael S. Tsirkin, Eli Cohen
  Cc: Jason Wang, Parav Pandit, virtualization, linux-kernel, kernel-janitors

There is a pointer math bug here so if "offset" is non-zero then this
will copy memory from beyond the end of the array.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 3ec44a4f0e45..9d1637cf772e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1758,7 +1758,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
 	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
 
 	if (offset + len < sizeof(struct virtio_net_config))
-		memcpy(buf, &ndev->config + offset, len);
+		memcpy(buf, (u8 *)&ndev->config + offset, len);
 }
 
 static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,
-- 
2.27.0


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

* [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-08  9:32 ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-08  9:32 UTC (permalink / raw)
  To: Michael S. Tsirkin, Eli Cohen
  Cc: Jason Wang, Parav Pandit, virtualization, linux-kernel, kernel-janitors

There is a pointer math bug here so if "offset" is non-zero then this
will copy memory from beyond the end of the array.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 3ec44a4f0e45..9d1637cf772e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1758,7 +1758,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
 	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
 
 	if (offset + len < sizeof(struct virtio_net_config))
-		memcpy(buf, &ndev->config + offset, len);
+		memcpy(buf, (u8 *)&ndev->config + offset, len);
 }
 
 static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,
-- 
2.27.0

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

* [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-08  9:32 ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-08  9:32 UTC (permalink / raw)
  To: Michael S. Tsirkin, Eli Cohen
  Cc: linux-kernel, kernel-janitors, Parav Pandit, virtualization

There is a pointer math bug here so if "offset" is non-zero then this
will copy memory from beyond the end of the array.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 3ec44a4f0e45..9d1637cf772e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1758,7 +1758,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
 	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
 
 	if (offset + len < sizeof(struct virtio_net_config))
-		memcpy(buf, &ndev->config + offset, len);
+		memcpy(buf, (u8 *)&ndev->config + offset, len);
 }
 
 static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,
-- 
2.27.0

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* RE: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
  2020-08-08  9:32 ` Dan Carpenter
@ 2020-08-09  6:34   ` Eli Cohen
  -1 siblings, 0 replies; 11+ messages in thread
From: Eli Cohen @ 2020-08-09  6:34 UTC (permalink / raw)
  To: Dan Carpenter, Michael S. Tsirkin, Eli Cohen
  Cc: Jason Wang, Parav Pandit, virtualization, linux-kernel, kernel-janitors

Acked-by: Eli Cohen <elic@nvidia.com>

BTW, vdpa_sim has the same bug.

-----Original Message-----
From: Dan Carpenter <dan.carpenter@oracle.com> 
Sent: Saturday, August 8, 2020 12:33 PM
To: Michael S. Tsirkin <mst@redhat.com>; Eli Cohen <eli@mellanox.com>
Cc: Jason Wang <jasowang@redhat.com>; Parav Pandit <parav@mellanox.com>; virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
Subject: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()

There is a pointer math bug here so if "offset" is non-zero then this will copy memory from beyond the end of the array.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 3ec44a4f0e45..9d1637cf772e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1758,7 +1758,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
 	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
 
 	if (offset + len < sizeof(struct virtio_net_config))
-		memcpy(buf, &ndev->config + offset, len);
+		memcpy(buf, (u8 *)&ndev->config + offset, len);
 }
 
 static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,
--
2.27.0


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

* RE: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-09  6:34   ` Eli Cohen
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Cohen @ 2020-08-09  6:34 UTC (permalink / raw)
  To: Dan Carpenter, Michael S. Tsirkin, Eli Cohen
  Cc: Jason Wang, Parav Pandit, virtualization, linux-kernel, kernel-janitors

Acked-by: Eli Cohen <elic@nvidia.com>

BTW, vdpa_sim has the same bug.

-----Original Message-----
From: Dan Carpenter <dan.carpenter@oracle.com> 
Sent: Saturday, August 8, 2020 12:33 PM
To: Michael S. Tsirkin <mst@redhat.com>; Eli Cohen <eli@mellanox.com>
Cc: Jason Wang <jasowang@redhat.com>; Parav Pandit <parav@mellanox.com>; virtualization@lists.linux-foundation.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org
Subject: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()

There is a pointer math bug here so if "offset" is non-zero then this will copy memory from beyond the end of the array.

Fixes: 1a86b377aa21 ("vdpa/mlx5: Add VDPA driver for supported mlx5 devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 3ec44a4f0e45..9d1637cf772e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1758,7 +1758,7 @@ static void mlx5_vdpa_get_config(struct vdpa_device *vdev, unsigned int offset,
 	struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
 
 	if (offset + len < sizeof(struct virtio_net_config))
-		memcpy(buf, &ndev->config + offset, len);
+		memcpy(buf, (u8 *)&ndev->config + offset, len);
 }
 
 static void mlx5_vdpa_set_config(struct vdpa_device *vdev, unsigned int offset, const void *buf,
--
2.27.0

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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
  2020-08-09  6:34   ` Eli Cohen
  (?)
@ 2020-08-10 10:31     ` Dan Carpenter
  -1 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-10 10:31 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Michael S. Tsirkin, Eli Cohen, Jason Wang, Parav Pandit,
	virtualization, linux-kernel, kernel-janitors

On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> Acked-by: Eli Cohen <elic@nvidia.com>
> 
> BTW, vdpa_sim has the same bug.
> 

I sent a patch for that on April 6.

[PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()

Jason acked the patch but it wasn't applied.

regards,
dan carpenter


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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-10 10:31     ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-10 10:31 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Michael S. Tsirkin, Eli Cohen, Jason Wang, Parav Pandit,
	virtualization, linux-kernel, kernel-janitors

On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> Acked-by: Eli Cohen <elic@nvidia.com>
> 
> BTW, vdpa_sim has the same bug.
> 

I sent a patch for that on April 6.

[PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()

Jason acked the patch but it wasn't applied.

regards,
dan carpenter

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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-10 10:31     ` Dan Carpenter
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2020-08-10 10:31 UTC (permalink / raw)
  To: Eli Cohen
  Cc: Parav Pandit, Michael S. Tsirkin, kernel-janitors, linux-kernel,
	virtualization, Eli Cohen

On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> Acked-by: Eli Cohen <elic@nvidia.com>
> 
> BTW, vdpa_sim has the same bug.
> 

I sent a patch for that on April 6.

[PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()

Jason acked the patch but it wasn't applied.

regards,
dan carpenter

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
  2020-08-10 10:31     ` Dan Carpenter
  (?)
@ 2020-08-10 14:35       ` Michael S. Tsirkin
  -1 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2020-08-10 14:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eli Cohen, Eli Cohen, Jason Wang, Parav Pandit, virtualization,
	linux-kernel, kernel-janitors

On Mon, Aug 10, 2020 at 01:31:47PM +0300, Dan Carpenter wrote:
> On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> > Acked-by: Eli Cohen <elic@nvidia.com>
> > 
> > BTW, vdpa_sim has the same bug.
> > 
> 
> I sent a patch for that on April 6.
> 
> [PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()
> 
> Jason acked the patch but it wasn't applied.
> 
> regards,
> dan carpenter

Oh sorry. I'll drop my patch and queue yours then.


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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-10 14:35       ` Michael S. Tsirkin
  0 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2020-08-10 14:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Eli Cohen, Eli Cohen, Jason Wang, Parav Pandit, virtualization,
	linux-kernel, kernel-janitors

On Mon, Aug 10, 2020 at 01:31:47PM +0300, Dan Carpenter wrote:
> On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> > Acked-by: Eli Cohen <elic@nvidia.com>
> > 
> > BTW, vdpa_sim has the same bug.
> > 
> 
> I sent a patch for that on April 6.
> 
> [PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()
> 
> Jason acked the patch but it wasn't applied.
> 
> regards,
> dan carpenter

Oh sorry. I'll drop my patch and queue yours then.

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

* Re: [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config()
@ 2020-08-10 14:35       ` Michael S. Tsirkin
  0 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2020-08-10 14:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Parav Pandit, kernel-janitors, linux-kernel, virtualization,
	Eli Cohen, Eli Cohen

On Mon, Aug 10, 2020 at 01:31:47PM +0300, Dan Carpenter wrote:
> On Sun, Aug 09, 2020 at 06:34:04AM +0000, Eli Cohen wrote:
> > Acked-by: Eli Cohen <elic@nvidia.com>
> > 
> > BTW, vdpa_sim has the same bug.
> > 
> 
> I sent a patch for that on April 6.
> 
> [PATCH 2/2] vdpa: Fix pointer math bug in vdpasim_get_config()
> 
> Jason acked the patch but it wasn't applied.
> 
> regards,
> dan carpenter

Oh sorry. I'll drop my patch and queue yours then.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

end of thread, other threads:[~2020-08-10 14:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  9:32 [PATCH] vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config() Dan Carpenter
2020-08-08  9:32 ` Dan Carpenter
2020-08-08  9:32 ` Dan Carpenter
2020-08-09  6:34 ` Eli Cohen
2020-08-09  6:34   ` Eli Cohen
2020-08-10 10:31   ` Dan Carpenter
2020-08-10 10:31     ` Dan Carpenter
2020-08-10 10:31     ` Dan Carpenter
2020-08-10 14:35     ` Michael S. Tsirkin
2020-08-10 14:35       ` Michael S. Tsirkin
2020-08-10 14:35       ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.