Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2013 22:32:33 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251396 - head/sys/dev/mps
Message-ID:  <201306042232.r54MWXPA004259@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 = &params->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 = &params.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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306042232.r54MWXPA004259>