From owner-svn-src-head@FreeBSD.ORG Tue Jun 4 22:32:34 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 28981FFC; Tue, 4 Jun 2013 22:32:34 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 00F121FC5; Tue, 4 Jun 2013 22:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r54MWXU8004261; Tue, 4 Jun 2013 22:32:33 GMT (envelope-from asomers@svn.freebsd.org) Received: (from asomers@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r54MWXPA004259; Tue, 4 Jun 2013 22:32:33 GMT (envelope-from asomers@svn.freebsd.org) Message-Id: <201306042232.r54MWXPA004259@svn.freebsd.org> From: Alan Somers Date: Tue, 4 Jun 2013 22:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r251396 - head/sys/dev/mps X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jun 2013 22:32:34 -0000 Author: asomers Date: Tue Jun 4 22:32:33 2013 New Revision: 251396 URL: http://svnweb.freebsd.org/changeset/base/251396 Log: sys/dev/mps/mps.c sys/dev/mps/mps_user.c Fix uninitialized memory reference in mps_read_config_page. It was referencing a field (params->hdr.Ext.ExtPageType) that would only be set when reading an Extended config page. The symptom was that MPSIO_READ_CFG_PAGE ioctls would randomly fail with MPI2_IOCSTATUS_CONFIG_INVALID_PAGE errors. The solution is to determine whether an extended or an ordinary config page is requested by looking at the PageType field, which should be available regardless. Similarly, mps_user_read_extcfg_header and mps_user_read_extcfg_page, which call mps_read_config_page, had to be fixed to always set the PageType field. They were implicitly assuming that mps_read_config_page always operated on Extended pages. Reviewed by: ken Approved by: ken (mentor) MFC after: 3 days Modified: head/sys/dev/mps/mps.c head/sys/dev/mps/mps_user.c Modified: head/sys/dev/mps/mps.c ============================================================================== --- head/sys/dev/mps/mps.c Tue Jun 4 22:29:19 2013 (r251395) +++ head/sys/dev/mps/mps.c Tue Jun 4 22:32:33 2013 (r251396) @@ -2387,7 +2387,7 @@ mps_read_config_page(struct mps_softc *s req->SGLFlags = 0; req->ChainOffset = 0; req->PageAddress = params->page_address; - if (params->hdr.Ext.ExtPageType != 0) { + if (params->hdr.Struct.PageType == MPI2_CONFIG_PAGETYPE_EXTENDED) { MPI2_CONFIG_EXTENDED_PAGE_HEADER *hdr; hdr = ¶ms->hdr.Ext; Modified: head/sys/dev/mps/mps_user.c ============================================================================== --- head/sys/dev/mps/mps_user.c Tue Jun 4 22:29:19 2013 (r251395) +++ head/sys/dev/mps/mps_user.c Tue Jun 4 22:32:33 2013 (r251396) @@ -305,6 +305,7 @@ mps_user_read_extcfg_header(struct mps_s hdr = ¶ms.hdr.Ext; params.action = MPI2_CONFIG_ACTION_PAGE_HEADER; hdr->PageVersion = ext_page_req->header.PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->ExtPageLength = 0; hdr->PageNumber = ext_page_req->header.PageNumber; hdr->ExtPageType = ext_page_req->header.ExtPageType; @@ -346,6 +347,7 @@ mps_user_read_extcfg_page(struct mps_sof params.action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; params.page_address = le32toh(ext_page_req->page_address); hdr->PageVersion = reqhdr->PageVersion; + hdr->PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; hdr->PageNumber = reqhdr->PageNumber; hdr->ExtPageType = reqhdr->ExtPageType; hdr->ExtPageLength = reqhdr->ExtPageLength;