Skip to contentSkip to conversation

tcp repair: Fix unaligned access when repairing options (v2)

PATCH In review Pavel Emelyanov 2 participants 2 messages Apr 26, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp repair: Fix unaligned access when repairing options (v2)

From: Pavel Emelyanov <[email protected]>

Don't pick __u8/__u16 values directly from raw pointers, but instead use an array of structures of code:value pairs. This is OK, since the buffer we take options from is not an skb memory, but a user-to-kernel one.

For those options which don't require any value now, require this to be zero (for potential future extension of this API).

v2: Changed tcp_repair_opt to use two __u32-s as spotted by David Laight.

---
 include/linux/tcp.h |    5 ++++
 net/ipv4/tcp.c      |   60 +++++++++++++++++---------------------------------
 2 files changed, 26 insertions(+), 39 deletions(-)
include/linux/tcp.h +5 -0
index 9865936..d0401d9 100644
@@ -111,6 +111,11 @@ enum {
 #define TCP_QUEUE_SEQ		21
 #define TCP_REPAIR_OPTIONS	22
 
+struct tcp_repair_opt {
+	__u32	opt_code;
+	__u32	opt_val;
+};
+
 enum {
 	TCP_NO_QUEUE,
 	TCP_RECV_QUEUE,
net/ipv4/tcp.c +21 -39

88 lines not on this page · raw message

maintainer
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Thu, 26 Apr 2012 13:43:04 +0400

Quoted 6 lines

From: Pavel Emelyanov <[email protected]>

Don't pick __u8/__u16 values directly from raw pointers, but instead use an array of structures of code:value pairs. This is OK, since the buffer we take options from is not an skb memory, but a user-to-kernel one.

Quoted 6 lines

For those options which don't require any value now, require this to be zero (for potential future extension of this API).

v2: Changed tcp_repair_opt to use two __u32-s as spotted by David Laight.

Seems to have worked this time, applied :-)