Skip to content

Commit

Permalink
tcp: sysctl interface leaks 16 bytes of kernel memory
Browse files Browse the repository at this point in the history
If the rc_dereference of tcp_fastopen_ctx ever fails then we copy 16 bytes
of kernel stack into the proc result.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alan Cox authored and David S. Miller committed Oct 11, 2012
1 parent 0abc1ce commit 0e24c4f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer,
ctxt = rcu_dereference(tcp_fastopen_ctx);
if (ctxt)
memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH);
else
memset(user_key, 0, sizeof(user_key));
rcu_read_unlock();

snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x",
Expand Down

0 comments on commit 0e24c4f

Please sign in to comment.