netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Eitzenberger <holger@my-eitzenberger.de>
To: netdev@vger.kernel.org
Subject: Re: [FIX NETLINK] properly check arguments to netlink_bind()
Date: Tue, 18 Sep 2007 23:05:52 +0200	[thread overview]
Message-ID: <876427elan.fsf@kruemel.my-eitzenberger.de> (raw)
In-Reply-To: <87fy1belij.fsf@kruemel.my-eitzenberger.de> (Holger Eitzenberger's message of "Tue, 18 Sep 2007 23:01:08 +0200")

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

Holger Eitzenberger <holger@my-eitzenberger.de> writes:

> while going through going netlink code I found out that netlink_bind()
> does not properly check bind parameters.  I checked both 2.6.23-rc1 as
> well as 2.6.16.53, both are affected.
>
> With a small test prog I wasn't able to crash my maschine though, but
> data was accessed out of bounds.

See my attached patch, thanks.

  /holger


[-- Attachment #2: netlink fix --]
[-- Type: text/plain, Size: 1108 bytes --]

[NETLINK] Check for correct bind parameters

Before this change it was possible to pass less than sockaddr_nl
bytes, which might lead to arbitrary data being accessed in
netlink_bind().

Signed-off-by: Holger Eitzenberger <holger@my-eitzenberger.de>

---
commit 53ba94ab22cc3338d915d684ba1012fa0419ff14
tree 3a1b1dc6cb5dacac99722b9f96fe3ba4b2d29bde
parent f695baf2df9e0413d3521661070103711545207a
author Holger Eitzenberger <holger@my-eitzenberger.de> Mon, 17 Sep 2007 22:15:37 +0200
committer Holger Eitzenberger <holger@elmo.(none)> Mon, 17 Sep 2007 22:15:37 +0200

 net/netlink/af_netlink.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 5681ce3..425543d 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -598,6 +598,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
 	struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
 	int err;
 
+	if (addr < sizeof(struct sockaddr_nl))
+		return -EINVAL;
+
 	if (nladdr->nl_family != AF_NETLINK)
 		return -EINVAL;
 

  reply	other threads:[~2007-09-18 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-18 21:01 [FIX NETLINK] properly check arguments to netlink_bind() Holger Eitzenberger
2007-09-18 21:05 ` Holger Eitzenberger [this message]
2007-09-18 21:14   ` Holger Eitzenberger
2007-09-18 21:53   ` David Miller
2007-09-19  7:16     ` Holger Eitzenberger

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=876427elan.fsf@kruemel.my-eitzenberger.de \
    --to=holger@my-eitzenberger.de \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).