From patchwork Wed Sep 15 21:43:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rosenberg X-Patchwork-Id: 64914 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 9143DB6EF1 for ; Thu, 16 Sep 2010 07:50:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755206Ab0IOVtf (ORCPT ); Wed, 15 Sep 2010 17:49:35 -0400 Received: from mx1.vsecurity.com ([209.67.252.12]:63526 "EHLO mx1.vsecurity.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754983Ab0IOVte (ORCPT ); Wed, 15 Sep 2010 17:49:34 -0400 Received: (qmail 53635 invoked from network); 15 Sep 2010 21:42:32 -0000 Received: from unknown (HELO [138.16.110.183]) (drosenbe@[138.16.110.183]) (envelope-sender ) by mx1.vsecurity.com (qmail-ldap-1.03) with SMTP for ; 15 Sep 2010 21:42:32 -0000 Subject: [PATCH v2] drivers/net/cxgb3/cxgb3_main.c: prevent reading uninitialized stack memory From: Dan Rosenberg To: divy@chelsio.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, security@kernel.org Date: Wed, 15 Sep 2010 17:43:12 -0400 Message-ID: <1284586992.6275.93.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 Fixed formatting (tabs and line breaks). The CHELSIO_GET_QSET_NUM device ioctl allows unprivileged users to read 4 bytes of uninitialized stack memory, because the "addr" member of the ch_reg struct declared on the stack in cxgb_extension_ioctl() is not altered or zeroed before being copied back to the user. This patch takes care of it. 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.35.4.orig/drivers/net/cxgb3/cxgb3_main.c 2010-08-26 19:47:12.000000000 -0400 +++ linux-2.6.35.4/drivers/net/cxgb3/cxgb3_main.c 2010-09-14 21:24:34.369511115 -0400 @@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct n case CHELSIO_GET_QSET_NUM:{ struct ch_reg edata; + memset(&edata, 0, sizeof(struct ch_reg)); + edata.cmd = CHELSIO_GET_QSET_NUM; edata.val = pi->nqsets; if (copy_to_user(useraddr, &edata, sizeof(edata)))