This is a note to let you know that I've just added the patch titled
tcp: protect sysctl_tcp_cookie_size reads
to the 2.6.36-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
tcp-protect-sysctl_tcp_cookie_size-reads.patch
and it can be found in the queue-2.6.36 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From e1e9ef4b173c9437d9966b2d953a2c624190d2c9 Mon Sep 17 00:00:00 2001
From: Eric Dumazet <[email protected]>
Date: Tue, 7 Dec 2010 12:20:47 +0000
Subject: tcp: protect sysctl_tcp_cookie_size reads
From: Eric Dumazet <[email protected]>
[ Upstream commit f19872575ff7819a3723154657a497d9bca66b33 ]
Make sure sysctl_tcp_cookie_size is read once in
tcp_cookie_size_check(), or we might return an illegal value to caller
if sysctl_tcp_cookie_size is changed by another cpu.
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Ben Hutchings <[email protected]>
Cc: William Allen Simpson <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
net/ipv4/tcp_output.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -391,27 +391,30 @@ struct tcp_out_options {
*/
static u8 tcp_cookie_size_check(u8 desired)
{
- if (desired > 0) {
+ int cookie_size;
+
+ if (desired > 0)
/* previously specified */
return desired;
- }
- if (sysctl_tcp_cookie_size <= 0) {
+
+ cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size);
+ if (cookie_size <= 0)
/* no default specified */
return 0;
- }
- if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) {
+
+ if (cookie_size <= TCP_COOKIE_MIN)
/* value too small, specify minimum */
return TCP_COOKIE_MIN;
- }
- if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) {
+
+ if (cookie_size >= TCP_COOKIE_MAX)
/* value too large, specify maximum */
return TCP_COOKIE_MAX;
- }
- if (0x1 & sysctl_tcp_cookie_size) {
+
+ if (cookie_size & 1)
/* 8-bit multiple, illegal, fix it */
- return (u8)(sysctl_tcp_cookie_size + 0x1);
- }
- return (u8)sysctl_tcp_cookie_size;
+ cookie_size++;
+
+ return (u8)cookie_size;
}
/* Write previously computed TCP options to the packet.
Patches currently in stable-queue which might be from [email protected] are
queue-2.6.36/tcp-protect-sysctl_tcp_cookie_size-reads.patch
queue-2.6.36/tcp-don-t-change-unlocked-socket-state-in-tcp_v4_err.patch
queue-2.6.36/net-dst-dst_dev_event-called-after-other-notifiers.patch
queue-2.6.36/pppoe.c-fix-kernel-panic-caused-by-__pppoe_xmit.patch
queue-2.6.36/net-fix-skb_defer_rx_timestamp.patch
queue-2.6.36/filter-fix-sk_filter-rcu-handling.patch
queue-2.6.36/af_unix-limit-unix_tot_inflight.patch
queue-2.6.36/llc-fix-a-device-refcount-imbalance.patch
queue-2.6.36/af_unix-limit-recursion-level.patch
queue-2.6.36/tcp-avoid-a-possible-divide-by-zero.patch
_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable