All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
@ 2017-09-04 11:23 ` Colin King
  0 siblings, 0 replies; 5+ messages in thread
From: Colin King @ 2017-09-04 11:23 UTC (permalink / raw)
  To: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	stable-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

resp.reserved has not been initialized and so the copy_to_user (via
ib_copy_to_udata) is copying uninitialized data from the stack back
to user space which is a potential information leak. Fix this by
setting resp.reserved to zero.

Fixes: 3c2d774cad5b ("RDMA/nes: Add a driver for NetEffect RNICs")
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> [2.6.24+]
Signed-off-by: Colin Ian King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/infiniband/hw/nes/nes_verbs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index f0dc5f4aa177..052c3822dfed 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1666,6 +1666,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
 		resp.cq_id = nescq->hw_cq.cq_number;
 		resp.cq_size = nescq->hw_cq.cq_size;
 		resp.mmap_db_index = 0;
+		resp.reserved = 0;
 		if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
 			nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
 			kfree(nescq);
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
@ 2017-09-04 11:23 ` Colin King
  0 siblings, 0 replies; 5+ messages in thread
From: Colin King @ 2017-09-04 11:23 UTC (permalink / raw)
  To: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma
  Cc: kernel-janitors, stable, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

resp.reserved has not been initialized and so the copy_to_user (via
ib_copy_to_udata) is copying uninitialized data from the stack back
to user space which is a potential information leak. Fix this by
setting resp.reserved to zero.

Fixes: 3c2d774cad5b ("RDMA/nes: Add a driver for NetEffect RNICs")
Cc: <stable@vger.kernel.org> [2.6.24+]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/hw/nes/nes_verbs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index f0dc5f4aa177..052c3822dfed 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1666,6 +1666,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
 		resp.cq_id = nescq->hw_cq.cq_number;
 		resp.cq_size = nescq->hw_cq.cq_size;
 		resp.mmap_db_index = 0;
+		resp.reserved = 0;
 		if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
 			nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
 			kfree(nescq);
-- 
2.14.1

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

* [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
@ 2017-09-04 11:23 ` Colin King
  0 siblings, 0 replies; 5+ messages in thread
From: Colin King @ 2017-09-04 11:23 UTC (permalink / raw)
  To: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	stable-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Colin Ian King <colin.king@canonical.com>

resp.reserved has not been initialized and so the copy_to_user (via
ib_copy_to_udata) is copying uninitialized data from the stack back
to user space which is a potential information leak. Fix this by
setting resp.reserved to zero.

Fixes: 3c2d774cad5b ("RDMA/nes: Add a driver for NetEffect RNICs")
Cc: <stable@vger.kernel.org> [2.6.24+]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/infiniband/hw/nes/nes_verbs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index f0dc5f4aa177..052c3822dfed 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1666,6 +1666,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
 		resp.cq_id = nescq->hw_cq.cq_number;
 		resp.cq_size = nescq->hw_cq.cq_size;
 		resp.mmap_db_index = 0;
+		resp.reserved = 0;
 		if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
 			nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
 			kfree(nescq);
-- 
2.14.1


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

* Re: [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
  2017-09-04 11:23 ` Colin King
@ 2017-09-04 12:17   ` Leon Romanovsky
  -1 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2017-09-04 12:17 UTC (permalink / raw)
  To: Colin King
  Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma, kernel-janitors, stable, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

On Mon, Sep 04, 2017 at 12:23:16PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> resp.reserved has not been initialized and so the copy_to_user (via
> ib_copy_to_udata) is copying uninitialized data from the stack back
> to user space which is a potential information leak. Fix this by
> setting resp.reserved to zero.
>
> Fixes: 3c2d774cad5b ("RDMA/nes: Add a driver for NetEffect RNICs")
> Cc: <stable@vger.kernel.org> [2.6.24+]
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/hw/nes/nes_verbs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
> index f0dc5f4aa177..052c3822dfed 100644
> --- a/drivers/infiniband/hw/nes/nes_verbs.c
> +++ b/drivers/infiniband/hw/nes/nes_verbs.c
> @@ -1666,6 +1666,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
>  		resp.cq_id = nescq->hw_cq.cq_number;
>  		resp.cq_size = nescq->hw_cq.cq_size;
>  		resp.mmap_db_index = 0;
> +		resp.reserved = 0;

Right and it is better to initialize the "struct nes_create_cq_resp resp" to zero
at the beginning of the function.

Thanks


>  		if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
>  			nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
>  			kfree(nescq);
> --
> 2.14.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
@ 2017-09-04 12:17   ` Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2017-09-04 12:17 UTC (permalink / raw)
  To: Colin King
  Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma, kernel-janitors, stable, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

On Mon, Sep 04, 2017 at 12:23:16PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> resp.reserved has not been initialized and so the copy_to_user (via
> ib_copy_to_udata) is copying uninitialized data from the stack back
> to user space which is a potential information leak. Fix this by
> setting resp.reserved to zero.
>
> Fixes: 3c2d774cad5b ("RDMA/nes: Add a driver for NetEffect RNICs")
> Cc: <stable@vger.kernel.org> [2.6.24+]
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/infiniband/hw/nes/nes_verbs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
> index f0dc5f4aa177..052c3822dfed 100644
> --- a/drivers/infiniband/hw/nes/nes_verbs.c
> +++ b/drivers/infiniband/hw/nes/nes_verbs.c
> @@ -1666,6 +1666,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
>  		resp.cq_id = nescq->hw_cq.cq_number;
>  		resp.cq_size = nescq->hw_cq.cq_size;
>  		resp.mmap_db_index = 0;
> +		resp.reserved = 0;

Right and it is better to initialize the "struct nes_create_cq_resp resp" to zero
at the beginning of the function.

Thanks


>  		if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
>  			nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
>  			kfree(nescq);
> --
> 2.14.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-09-04 12:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 11:23 [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace Colin King
2017-09-04 11:23 ` Colin King
2017-09-04 11:23 ` Colin King
2017-09-04 12:17 ` Leon Romanovsky
2017-09-04 12:17   ` Leon Romanovsky

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.