lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 Jun 2014 11:42:31 -0400
From:	Dave Jones <davej@...hat.com>
To:	Sasha Levin <sasha.levin@...cle.com>
Cc:	Arnaldo Carvalho de Melo <acme@...hat.com>,
	"David S. Miller" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: net: llc: NULL ptr deref in llc_ui_sendmsg

On Fri, Jun 06, 2014 at 11:08:33AM -0400, Sasha Levin wrote:
 > Hi all,
 > 
 > While fuzzing with trinity inside a KVM tools guest running the latest -next
 > kernel I've stumbled on the following spew:
 > 
 > [  269.531162] BUG: unable to handle kernel NULL pointer dereference at 000000000000021e
 > [  269.531217] IP: llc_ui_sendmsg (net/llc/af_llc.c:912)

 905         /* must bind connection to sap if user hasn't done it. */
 906         if (sock_flag(sk, SOCK_ZAPPED)) {
 907                 /* bind to sap with null dev, exclusive. */
 908                 rc = llc_ui_autobind(sock, addr);
 909                 if (rc)
 910                         goto release;
 911         }
 912         hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);

looks like llc->dev was null, (understandable, given Trinity doesn't really know
how to set up llc beyond random socket()/setsockopt() calls).

llc_ui_autobind returns -ENODEV in that case, so it looks like the SOCK_ZAPPED test
was false. Something like the patch below maybe ? It feels ugly to be duplicating that
test there, but if this is agreed upon I'll resubmit this properly.

	Dave

diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 0080d2b0a8ae..9b192db9883b 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -908,6 +908,11 @@ static int llc_ui_sendmsg(struct kiocb *iocb, struct socket *sock,
 		rc = llc_ui_autobind(sock, addr);
 		if (rc)
 			goto release;
+	} else {
+		if (!llc->dev) {
+			rc = -ENODEV;
+			goto release;
+		}
 	}
 	hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);
 	size = hdrlen + len;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ