From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Kefeng Wang <wangkefeng.wang@huawei.com>,
John Garry <john.garry@huawei.com>,
Guenter Roeck <linux@roeck-us.net>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.9 075/128] hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
Date: Wed, 29 May 2019 20:06:47 -0700 [thread overview]
Message-ID: <20190530030448.157699409@linuxfoundation.org> (raw)
In-Reply-To: <20190530030432.977908967@linuxfoundation.org>
[ Upstream commit 755a9b0f8aaa5639ba5671ca50080852babb89ce ]
Super-IO accesses may fail on a system with no or unmapped LPC bus.
Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.
Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.
Fixes: ba224e2c4f0a7 ("hwmon: New PC87427 hardware monitoring driver")
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reported-by: John Garry <john.garry@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/pc87427.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c
index cb9fdd37bd0d9..2b5b8c3de8fce 100644
--- a/drivers/hwmon/pc87427.c
+++ b/drivers/hwmon/pc87427.c
@@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" };
#define LD_IN 1
#define LD_TEMP 1
+static inline int superio_enter(int sioaddr)
+{
+ if (!request_muxed_region(sioaddr, 2, DRVNAME))
+ return -EBUSY;
+ return 0;
+}
+
static inline void superio_outb(int sioaddr, int reg, int val)
{
outb(reg, sioaddr);
@@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr)
{
outb(0x02, sioaddr);
outb(0x02, sioaddr + 1);
+ release_region(sioaddr, 2);
}
/*
@@ -1220,7 +1228,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data)
{
u16 val;
u8 cfg, cfg_b;
- int i, err = 0;
+ int i, err;
+
+ err = superio_enter(sioaddr);
+ if (err)
+ return err;
/* Identify device */
val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID);
--
2.20.1
next prev parent reply other threads:[~2019-05-30 3:44 UTC|newest]
Thread overview: 134+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-30 3:05 [PATCH 4.9 000/128] 4.9.180-stable review Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 001/128] ext4: do not delete unlinked inode from orphan list on failed truncate Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 002/128] KVM: x86: fix return value for reserved EFER Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 003/128] bio: fix improper use of smp_mb__before_atomic() Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 004/128] Revert "scsi: sd: Keep disk read-only when re-reading partition" Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 005/128] crypto: vmx - CTR: always increment IV as quadword Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 006/128] kvm: svm/avic: fix off-by-one in checking host APIC ID Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 007/128] libnvdimm/namespace: Fix label tracking error Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 008/128] arm64: Save and restore OSDLR_EL1 across suspend/resume Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 009/128] gfs2: Fix sign extension bug in gfs2_update_stats Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 010/128] Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 011/128] Btrfs: fix race between ranged fsync and writeback of adjacent ranges Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 012/128] btrfs: sysfs: dont leak memory when failing add fsid Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 013/128] fbdev: fix divide error in fb_var_to_videomode Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 014/128] hugetlb: use same fault hash key for shared and private mappings Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 015/128] fbdev: fix WARNING in __alloc_pages_nodemask bug Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 016/128] media: cpia2: Fix use-after-free in cpia2_exit Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 017/128] media: vivid: use vfree() instead of kfree() for dev->bitmap_cap Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 018/128] ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 019/128] at76c50x-usb: Dont register led_trigger if usb_register_driver failed Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 020/128] perf tools: No need to include bitops.h in util.h Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 021/128] tools include: Adopt linux/bits.h Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 022/128] Revert "btrfs: Honour FITRIM range constraints during free space trim" Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 023/128] gfs2: Fix lru_count going negative Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 024/128] cxgb4: Fix error path in cxgb4_init_module Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 025/128] mmc: core: Verify SD bus width Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 026/128] dmaengine: tegra210-dma: free dma controller in remove() Greg Kroah-Hartman
2019-05-30 3:05 ` [PATCH 4.9 027/128] net: ena: gcc 8: fix compilation warning Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 028/128] ASoC: hdmi-codec: unlock the device on startup errors Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 029/128] powerpc/boot: Fix missing check of lseek() return value Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 030/128] ASoC: imx: fix fiq dependencies Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 031/128] spi: pxa2xx: fix SCR (divisor) calculation Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 032/128] brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler() Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 033/128] ARM: vdso: Remove dependency with the arch_timer driver internals Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 034/128] arm64: Fix compiler warning from pte_unmap() with -Wunused-but-set-variable Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 035/128] sched/cpufreq: Fix kobject memleak Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 036/128] scsi: qla2xxx: Fix a qla24xx_enable_msix() error path Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 037/128] iwlwifi: pcie: dont crash on invalid RX interrupt Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 038/128] rtc: 88pm860x: prevent use-after-free on device remove Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 039/128] w1: fix the resume command API Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 040/128] dmaengine: pl330: _stop: clear interrupt status Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 041/128] mac80211/cfg80211: update bss channel on channel switch Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 042/128] ASoC: fsl_sai: Update is_slave_mode with correct value Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 043/128] mwifiex: prevent an array overflow Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 044/128] net: cw1200: fix a NULL pointer dereference Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 045/128] crypto: sun4i-ss - Fix invalid calculation of hash end Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 046/128] bcache: return error immediately in bch_journal_replay() Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 047/128] bcache: fix failure in journal relplay Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 048/128] bcache: add failure check to run_cache_set() for journal replay Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 049/128] bcache: avoid clang -Wunintialized warning Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 050/128] x86/build: Move _etext to actual end of .text Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 051/128] smpboot: Place the __percpu annotation correctly Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 052/128] x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault() Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 053/128] mm/uaccess: Use unsigned long to placate UBSAN warnings on older GCC versions Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 054/128] HID: logitech-hidpp: use RAP instead of FAP to get the protocol version Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 055/128] pinctrl: pistachio: fix leaked of_node references Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 056/128] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 057/128] media: coda: clear error return value before picture run Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 058/128] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 059/128] media: au0828: stop video streaming only when last user stops Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 060/128] media: ov2659: make S_FMT succeed even if requested format doesnt match Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 061/128] audit: fix a memory leak bug Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 062/128] media: au0828: Fix NULL pointer dereference in au0828_analog_stream_enable() Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 063/128] media: pvrusb2: Prevent a buffer overflow Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 064/128] powerpc/numa: improve control of topology updates Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 065/128] sched/core: Check quota and period overflow at usec to nsec conversion Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 066/128] sched/core: Handle overflow in cpu_shares_write_u64 Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 067/128] USB: core: Dont unbind interfaces following device reset failure Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 068/128] x86/irq/64: Limit IST stack overflow check to #DB stack Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 069/128] i40e: dont allow changes to HW VLAN stripping on active port VLANs Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 070/128] arm64: vdso: Fix clock_getres() for CLOCK_REALTIME Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 071/128] RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 072/128] hwmon: (vt1211) Use request_muxed_region for Super-IO accesses Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 073/128] hwmon: (smsc47m1) " Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 074/128] hwmon: (smsc47b397) " Greg Kroah-Hartman
2019-05-30 3:06 ` Greg Kroah-Hartman [this message]
2019-05-30 3:06 ` [PATCH 4.9 076/128] hwmon: (f71805f) " Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 077/128] scsi: libsas: Do discovery on empty PHY to update PHY info Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 078/128] mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 079/128] mmc_spi: add a status check for spi_sync_locked Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 080/128] mmc: sdhci-of-esdhc: add erratum eSDHC5 support Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 081/128] mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 082/128] PM / core: Propagate dev->power.wakeup_path when no callbacks Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 083/128] extcon: arizona: Disable mic detect if running when driver is removed Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 084/128] s390: cio: fix cio_irb declaration Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 085/128] cpufreq: ppc_cbe: fix possible object reference leak Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 086/128] cpufreq/pasemi: " Greg Kroah-Hartman
2019-05-30 3:06 ` [PATCH 4.9 087/128] cpufreq: pmac32: " Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 088/128] x86/build: Keep local relocations with ld.lld Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 089/128] iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 090/128] iio: hmc5843: fix potential NULL pointer dereferences Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 091/128] iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 092/128] rtlwifi: fix a potential NULL pointer dereference Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 093/128] mwifiex: Fix mem leak in mwifiex_tm_cmd Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 094/128] brcmfmac: fix missing checks for kmemdup Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 095/128] b43: shut up clang -Wuninitialized variable warning Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 096/128] brcmfmac: convert dev_init_lock mutex to completion Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 097/128] brcmfmac: fix race during disconnect when USB completion is in progress Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 098/128] brcmfmac: fix Oops when bringing up interface during USB disconnect Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 099/128] scsi: ufs: Fix regulator load and icc-level configuration Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 100/128] scsi: ufs: Avoid configuring regulator with undefined voltage range Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 101/128] arm64: cpu_ops: fix a leaked reference by adding missing of_node_put Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 102/128] x86/uaccess, signal: Fix AC=1 bloat Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 103/128] x86/ia32: Fix ia32_restore_sigcontext() AC leak Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 104/128] chardev: add additional check for minor range overlap Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 105/128] HID: core: move Usage Page concatenation to Main item Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 106/128] ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 107/128] ASoC: fsl_utils: " Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 108/128] cxgb3/l2t: Fix undefined behaviour Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 109/128] spi: tegra114: reset controller on probe Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 110/128] media: wl128x: prevent two potential buffer overflows Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 111/128] virtio_console: initialize vtermno value for ports Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 112/128] tty: ipwireless: fix missing checks for ioremap Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 113/128] x86/mce: Fix machine_check_poll() tests for error types Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 114/128] rcutorture: Fix cleanup path for invalid torture_type strings Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 115/128] rcuperf: Fix cleanup path for invalid perf_type strings Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 116/128] usb: core: Add PM runtime calls to usb_hcd_platform_shutdown Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 117/128] scsi: qla4xxx: avoid freeing unallocated dma memory Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 118/128] dmaengine: tegra210-adma: use devm_clk_*() helpers Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 119/128] media: m88ds3103: serialize reset messages in m88ds3103_set_frontend Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 120/128] media: go7007: avoid clang frame overflow warning with KASAN Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 121/128] scsi: lpfc: Fix FDMI manufacturer attribute value Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 122/128] media: saa7146: avoid high stack usage with clang Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 123/128] scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 124/128] spi : spi-topcliff-pch: Fix to handle empty DMA buffers Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 125/128] spi: rspi: Fix sequencer reset during initialization Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 126/128] spi: Fix zero length xfer bug Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 127/128] ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM Greg Kroah-Hartman
2019-05-30 3:07 ` [PATCH 4.9 128/128] drm: Wake up next in drm_read() chain if we are forced to putback the event Greg Kroah-Hartman
2019-05-30 9:09 ` [PATCH 4.9 000/128] 4.9.180-stable review kernelci.org bot
2019-05-30 13:21 ` Jon Hunter
2019-05-30 16:27 ` Naresh Kamboju
2019-05-30 18:27 ` Guenter Roeck
2019-05-30 19:44 ` shuah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190530030448.157699409@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=john.garry@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).