public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Colin King <colin.king@canonical.com>
Cc: Faisal Latif <faisal.latif@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org, kernel-janitors@vger.kernel.org,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace
Date: Mon, 4 Sep 2017 15:17:01 +0300	[thread overview]
Message-ID: <20170904121701.GS10539@mtr-leonro.local> (raw)
In-Reply-To: <20170904112316.23832-1-colin.king@canonical.com>

[-- 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 --]

      reply	other threads:[~2017-09-04 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 11:23 [PATCH] RDMA/nes: do not leak uninitialized resp.reserved to userspace Colin King
2017-09-04 12:17 ` Leon Romanovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170904121701.GS10539@mtr-leonro.local \
    --to=leon@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox