summaryrefslogtreecommitdiffstats
path: root/sys/dev/mps
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2013-06-04 22:32:33 +0000
committerasomers <asomers@FreeBSD.org>2013-06-04 22:32:33 +0000
commit9a638117821b8de32c1f05d7244562702b4155b6 (patch)
tree7b9cf2b8541f3caf0c3ad1ae51756b46f7e26b8c /sys/dev/mps
parente44e86f2ac06954613af9495cb38c4d4da6ce1d8 (diff)
downloadFreeBSD-src-9a638117821b8de32c1f05d7244562702b4155b6.zip
FreeBSD-src-9a638117821b8de32c1f05d7244562702b4155b6.tar.gz
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
Diffstat (limited to 'sys/dev/mps')
-rw-r--r--sys/dev/mps/mps.c2
-rw-r--r--sys/dev/mps/mps_user.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index 5e41b0a..a842373 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -2387,7 +2387,7 @@ mps_read_config_page(struct mps_softc *sc, struct mps_config_params *params)
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;
diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c
index 0413d3f..c7bd89a 100644
--- a/sys/dev/mps/mps_user.c
+++ b/sys/dev/mps/mps_user.c
@@ -305,6 +305,7 @@ mps_user_read_extcfg_header(struct mps_softc *sc,
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_softc *sc,
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;
OpenPOWER on IntegriCloud