All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Kirch <okir@suse.de>
To: netdev@oss.sgi.com
Subject: [PATCH] Check for SOL_SOCKET in compat_sys_getsockopt
Date: Mon, 3 Jan 2005 15:33:06 +0100	[thread overview]
Message-ID: <20050103143306.GG25446@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

compat_sys_getsockopt checks for SO_RCVTIMEO/SO_SNDTIMEO without
making sure that the level is actually SOL_SOCKET. This can break
getsockopt() requests for other protocols.

Cheers, and a happy new year to everyone!
Olaf
-- 
Olaf Kirch     | Things that make Monday morning interesting, #2:
okir@suse.de   |        "We have 8,000 NFS mount points, why do we keep
---------------+ 	 running out of privileged ports?"

[-- Attachment #2: setsockopt-compat --]
[-- Type: text/plain, Size: 962 bytes --]

Subject: check for SOL_SOCKET in compat_sys_getsocket

compat_sys_getsockopt checks for SO_RCVTIMEO/SO_SNDTIMEO without
making sure that the level is actually SOL_SOCKET. This can break
getsockopt() requests for other protocols.

Signed-off-by: Olaf Kirch <okir@suse.de>

Index: linux-2.6.9/net/compat.c
===================================================================
--- linux-2.6.9.orig/net/compat.c	2005-01-03 15:25:11.000000000 +0100
+++ linux-2.6.9/net/compat.c	2005-01-03 15:25:29.000000000 +0100
@@ -507,7 +507,8 @@ static int do_get_sock_timeout(int fd, i
 asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
 				char __user *optval, int __user *optlen)
 {
-	if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO)
+	if (level == SOL_SOCKET &&
+	    (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
 		return do_get_sock_timeout(fd, level, optname, optval, optlen);
 	return sys_getsockopt(fd, level, optname, optval, optlen);
 }

             reply	other threads:[~2005-01-03 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-03 14:33 Olaf Kirch [this message]
2005-01-07 10:35 ` [PATCH] Check for SOL_SOCKET in compat_sys_getsockopt David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050103143306.GG25446@suse.de \
    --to=okir@suse.de \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.