Some sysfs objects of the dfl/intel-m10bmc driver can return -EINVAL when read.
In this case, reading the fpga_boot_page file results in -EINVAL if PMCI_CONFIGED bit of the PMCI CSR M10BMC_PMCI_FPGA_CONF_STS word is 0.
(i.e. the FPGA failed to be configured from FLASH, but is configured from JTAG.)
https://github.com/OFS/linux-dfl/blob/6b0d820d436dda1e5949205a8f081fe0360c8430/drivers/fpga/intel-m10-bmc-sec-update.c#L1105
sysfs_node#value() method opens and reads the fpga_boot_page file.
It handles and raises IOError.
It does not handle OSError from -EINVAL.
|
@property |
|
def value(self): |
|
"""value Read the value of a sysfs attribute |
|
|
|
Returns: The string returned (trimmed of whitespace) from reading the |
|
attribute. |
|
|
|
Raises: |
|
IOError: If an IOError is caught while attempting to open the path |
|
object represented by this node. |
|
|
|
Note: |
|
Attempting to get a value from a sysfs path that is a directory |
|
will result in an IOError being raised. |
|
""" |
|
try: |
|
with self._open('r') as fd: |
|
return fd.read().strip() |
|
except IOError as err: |
|
self.log.exception('error opening: %s - %s', self.sysfs_path, err) |
|
raise |
fpgasupdate calls sysfs_node#value() without handling OSError or IOError, so it crashes if the FPGA is configured from JTAG.
|
LOG.debug ("Boot page value: %s\n", boot_page.value) |
To fix this, some error handling needs to be implemented, either in sysfs_node class or fpgasupdate.py.
Some sysfs objects of the dfl/intel-m10bmc driver can return
-EINVALwhen read.In this case, reading the
fpga_boot_pagefile results in-EINVALifPMCI_CONFIGEDbit of the PMCI CSRM10BMC_PMCI_FPGA_CONF_STSword is 0.(i.e. the FPGA failed to be configured from FLASH, but is configured from JTAG.)
https://github.com/OFS/linux-dfl/blob/6b0d820d436dda1e5949205a8f081fe0360c8430/drivers/fpga/intel-m10-bmc-sec-update.c#L1105
sysfs_node#value()method opens and reads thefpga_boot_pagefile.It handles and raises
IOError.It does not handle
OSErrorfrom-EINVAL.opae-sdk/python/opae.admin/opae/admin/sysfs.py
Lines 151 to 171 in 5b22807
fpgasupdatecallssysfs_node#value()without handlingOSErrororIOError, so it crashes if the FPGA is configured from JTAG.opae-sdk/python/opae.admin/opae/admin/tools/fpgasupdate.py
Line 841 in 5b22807
To fix this, some error handling needs to be implemented, either in
sysfs_nodeclass orfpgasupdate.py.