rds: fix an infoleak in rds_inc_info_copy

Message ID 1464855080-29671-1-git-send-email-kjlu@gatech.edu
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Kangjie Lu June 2, 2016, 8:11 a.m.
The last field "flags" of object "minfo" is not initialized.
Copying this object out may leak kernel stack data.
Assign 0 to it to avoid leak.

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
---
 net/rds/recv.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Santosh Shilimkar June 2, 2016, 3:25 p.m. | #1
On 6/2/2016 1:11 AM, Kangjie Lu wrote:
> The last field "flags" of object "minfo" is not initialized.
> Copying this object out may leak kernel stack data.
> Assign 0 to it to avoid leak.
>
> Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
> ---
>  net/rds/recv.c | 2 ++
>  1 file changed, 2 insertions(+)
>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
David Miller June 3, 2016, 4:33 a.m. | #2
From: Kangjie Lu <kangjielu@gmail.com>
Date: Thu,  2 Jun 2016 04:11:20 -0400

> The last field "flags" of object "minfo" is not initialized.
> Copying this object out may leak kernel stack data.
> Assign 0 to it to avoid leak.
> 
> Signed-off-by: Kangjie Lu <kjlu@gatech.edu>

Applied.

Patch

diff --git a/net/rds/recv.c b/net/rds/recv.c
index c0be1ec..8413f6c 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -561,5 +561,7 @@  void rds_inc_info_copy(struct rds_incoming *inc,
 		minfo.fport = inc->i_hdr.h_dport;
 	}
 
+	minfo.flags = 0;
+
 	rds_info_copy(iter, &minfo, sizeof(minfo));
 }