mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
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
This commit is contained in:
parent
95c5ac34ba
commit
2ce303e83d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=251396
@ -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 = ¶ms->hdr.Ext;
|
||||
|
@ -305,6 +305,7 @@ mps_user_read_extcfg_header(struct mps_softc *sc,
|
||||
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_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;
|
||||
|
Loading…
Reference in New Issue
Block a user