From patchwork Tue Nov 2 15:02:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rosenberg X-Patchwork-Id: 69894 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B6176B70E9 for ; Wed, 3 Nov 2010 02:02:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304Ab0KBPCw (ORCPT ); Tue, 2 Nov 2010 11:02:52 -0400 Received: from mx1.vsecurity.com ([209.67.252.12]:49506 "EHLO mx1.vsecurity.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752966Ab0KBPCv (ORCPT ); Tue, 2 Nov 2010 11:02:51 -0400 Received: (qmail 71709 invoked from network); 2 Nov 2010 15:02:49 -0000 Received: from 75-144-181-206-newengland.hfc.comcastbusiness.net (HELO [172.20.64.61]) (drosenbe@[75.144.181.206]) (envelope-sender ) by mx1.vsecurity.com (qmail-ldap-1.03) with SMTP for ; 2 Nov 2010 15:02:49 -0000 Subject: [SECURITY] memory corruption in X.25 facilities parsing From: Dan Rosenberg To: andrew.hendry@gmail.com Cc: netdev@vger.kernel.org, security@kernel.org, stable@kernel.org Date: Tue, 02 Nov 2010 11:02:48 -0400 Message-ID: <1288710168.2504.6.camel@dan> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I put this together after a quick glance, so if someone knows this code better than I do (i.e. at all), feel free to comment or drop this patch if it's unnecessary. A value of 0 will cause a memcpy() of ULONG_MAX size, destroying the kernel heap. Signed-off-by: Dan Rosenberg --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-2.6.36-rc6.orig/net/x25/x25_facilities.c 2010-09-28 21:01:22.000000000 -0400 +++ linux-2.6.36-rc6/net/x25/x25_facilities.c 2010-11-02 10:36:02.827291324 -0400 @@ -134,14 +134,14 @@ int x25_parse_facilities(struct sk_buff case X25_FAC_CLASS_D: switch (*p) { case X25_FAC_CALLING_AE: - if (p[1] > X25_MAX_DTE_FACIL_LEN) + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] == 0) break; dte_facs->calling_len = p[2]; memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); *vc_fac_mask |= X25_MASK_CALLING_AE; break; case X25_FAC_CALLED_AE: - if (p[1] > X25_MAX_DTE_FACIL_LEN) + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] == 0) break; dte_facs->called_len = p[2]; memcpy(dte_facs->called_ae, &p[3], p[1] - 1);