bus/pci: fix Intel IOMMU sysfs access check
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 13 Aug 2019 15:38:22 +0000 (08:38 -0700)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 9 Oct 2019 08:22:45 +0000 (10:22 +0200)
commit2e8d5cf7631cbc5efb4b3abf7393d2526dee0424
tree0d1ada5aba443294f6127f0874c337ade0a20569
parent35860849cf13402cf4ed821f986f3f7720bf5046
bus/pci: fix Intel IOMMU sysfs access check

Just open the sysfs file and handle failure, rather than using access().
This eliminates Coverity warnings about TOCTOU
"time of check versus time of use"; although for this sysfs file that is
not really an issue anyway.

Coverity issue: 347276
Fixes: 54a328f552ff ("bus/pci: forbid IOVA mode if IOMMU address width too small")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
drivers/bus/pci/linux/pci.c