]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
NULL termination of SO_BINDTODEVICE string, from DaveM
authorChris Wright <chrisw@sous-sol.org>
Fri, 24 Mar 2006 07:28:43 +0000 (23:28 -0800)
committerChris Wright <chrisw@sous-sol.org>
Fri, 24 Mar 2006 07:28:43 +0000 (23:28 -0800)
queue-2.6.16/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch [new file with mode: 0644]
queue-2.6.16/series
queue/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch [new file with mode: 0644]
queue/series

diff --git a/queue-2.6.16/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch b/queue-2.6.16/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch
new file mode 100644 (file)
index 0000000..c2ca46c
--- /dev/null
@@ -0,0 +1,34 @@
+From stable-bounces@linux.kernel.org  Thu Mar 23 22:55:25 2006
+Date: Thu, 23 Mar 2006 22:54:18 -0800 (PST)
+From: "David S. Miller" <davem@davemloft.net>
+To: stable@kernel.org
+Cc: 
+Subject: NET: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.
+
+The user can pass us arbitrary garbage so we should ensure the
+string they give us is null terminated before we pass it on
+to dev_get_by_index() et al.
+
+Found by Solar Designer.
+
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+
+ net/core/sock.c |    5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+--- linux-2.6.16.orig/net/core/sock.c
++++ linux-2.6.16/net/core/sock.c
+@@ -404,8 +404,9 @@ set_rcvbuf:
+                       if (!valbool) {
+                               sk->sk_bound_dev_if = 0;
+                       } else {
+-                              if (optlen > IFNAMSIZ) 
+-                                      optlen = IFNAMSIZ; 
++                              if (optlen > IFNAMSIZ - 1)
++                                      optlen = IFNAMSIZ - 1;
++                              memset(devname, 0, sizeof(devname));
+                               if (copy_from_user(devname, optval, optlen)) {
+                                       ret = -EFAULT;
+                                       break;
index 9cde35ee4dd1faf60f20999f96e5d379c7fe13f3..b2354b9b3b7edea3b2acc5253b202b660c5ed2cc 100644 (file)
@@ -4,3 +4,4 @@ kconfig-video_decoder-must-select-fw_loader.patch
 2.6.xx-sata_mv-another-critical-fix.patch
 tcp-do-not-use-inet-id-of-global-tcp_socket-when-sending-rst.patch
 xfs-writeout-fix.patch
+net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch
diff --git a/queue/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch b/queue/net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch
new file mode 100644 (file)
index 0000000..4787ee5
--- /dev/null
@@ -0,0 +1,34 @@
+From stable-bounces@linux.kernel.org  Thu Mar 23 22:55:25 2006
+Date: Thu, 23 Mar 2006 22:54:18 -0800 (PST)
+From: "David S. Miller" <davem@davemloft.net>
+To: stable@kernel.org
+Cc: 
+Subject: NET: Ensure device name passed to SO_BINDTODEVICE is NULL terminated.
+
+The user can pass us arbitrary garbage so we should ensure the
+string they give us is null terminated before we pass it on
+to dev_get_by_index() et al.
+
+Found by Solar Designer.
+
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Chris Wright <chrisw@sous-sol.org>
+---
+
+ net/core/sock.c |    5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+--- linux-2.6.15.6.orig/net/core/sock.c
++++ linux-2.6.15.6/net/core/sock.c
+@@ -403,8 +403,9 @@ set_rcvbuf:
+                       if (!valbool) {
+                               sk->sk_bound_dev_if = 0;
+                       } else {
+-                              if (optlen > IFNAMSIZ) 
+-                                      optlen = IFNAMSIZ; 
++                              if (optlen > IFNAMSIZ - 1)
++                                      optlen = IFNAMSIZ - 1;
++                              memset(devname, 0, sizeof(devname));
+                               if (copy_from_user(devname, optval, optlen)) {
+                                       ret = -EFAULT;
+                                       break;
index bad1e52fe9b2180660e110755d7e5a56ce29fe06..ff952e30f6cd1314f447d66832cdc0311fc7e301 100644 (file)
@@ -4,3 +4,4 @@ compat-ifconf-fix-limits.patch
 cramfs-mounts-provide-corrupted-content-since-2.6.15.patch
 kconfig-video_decoder-must-select-fw_loader.patch
 tcp-do-not-use-inet-id-of-global-tcp_socket-when-sending-rst.patch
+net-ensure-device-name-passed-to-so_bindtodevice-is-null-terminated.patch