* [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
@ 2017-09-04 13:37 Colin King
2017-09-04 13:56 ` Leon Romanovsky
2017-09-05 14:40 ` Chien Tin Tung
0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2017-09-04 13:37 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
initializing all of resp to zero.
V2: Initialize all of the struct rather than just resp.reserved as
suggested by Leon Romanovsky.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/infiniband/hw/nes/nes_verbs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index f0dc5f4aa177..8998d11449c0 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -1437,7 +1437,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev,
struct nes_hw_cqp_wqe *cqp_wqe;
struct nes_pbl *nespbl = NULL;
struct nes_create_cq_req req;
- struct nes_create_cq_resp resp;
+ struct nes_create_cq_resp resp = { 0 };
u32 cq_num = 0;
u32 opcode = 0;
u32 pbl_entries = 1;
--
2.14.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
2017-09-04 13:37 [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Colin King
@ 2017-09-04 13:56 ` Leon Romanovsky
2017-09-05 14:40 ` Chien Tin Tung
1 sibling, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2017-09-04 13:56 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: 622 bytes --]
On Mon, Sep 04, 2017 at 02:37:05PM +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
> initializing all of resp to zero.
>
> V2: Initialize all of the struct rather than just resp.reserved as
> suggested by Leon Romanovsky.
Small nitpick, it is better to put changelog under "---" marker, so
it won't be visible in the git log.
Thanks
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
2017-09-04 13:37 [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Colin King
2017-09-04 13:56 ` Leon Romanovsky
@ 2017-09-05 14:40 ` Chien Tin Tung
2017-09-05 14:45 ` Colin Ian King
1 sibling, 1 reply; 4+ messages in thread
From: Chien Tin Tung @ 2017-09-05 14:40 UTC (permalink / raw)
To: Colin King
Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma, kernel-janitors, stable, linux-kernel
On Mon, Sep 04, 2017 at 02:37:05PM +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
> initializing all of resp to zero.
Reserved field is not copied as the length of reserved is subtracted
from the size of resp and passed to ib_copy_to_udata.
if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
This patch is not necessary.
Chien
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit
2017-09-05 14:40 ` Chien Tin Tung
@ 2017-09-05 14:45 ` Colin Ian King
0 siblings, 0 replies; 4+ messages in thread
From: Colin Ian King @ 2017-09-05 14:45 UTC (permalink / raw)
To: Chien Tin Tung
Cc: Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
linux-rdma, kernel-janitors, stable, linux-kernel
On 05/09/17 15:40, Chien Tin Tung wrote:
> On Mon, Sep 04, 2017 at 02:37:05PM +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
>> initializing all of resp to zero.
>
> Reserved field is not copied as the length of reserved is subtracted
> from the size of resp and passed to ib_copy_to_udata.
>
> if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {
>
>
> This patch is not necessary.
Apologies, I completely overlooked that.
>
> Chien
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-05 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-04 13:37 [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Colin King
2017-09-04 13:56 ` Leon Romanovsky
2017-09-05 14:40 ` Chien Tin Tung
2017-09-05 14:45 ` Colin Ian King
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).