OSDN Git Service

switchtec: Fix SWITCHTEC_IOCTL_EVENT_IDX_ALL flags overwrite
authorJoey Zhang <joey.zhang@microchip.com>
Mon, 10 Dec 2018 09:12:22 +0000 (17:12 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 12 Dec 2018 22:32:16 +0000 (16:32 -0600)
commite4a7dca5de625018b29417ecc39dc5037d9a5a36
tree0ca3bd146d1c6011ed4b23c74ea88cdc9b197bf5
parentaff614c6339c1ee2a74ea0afc491d6e30d0bad61
switchtec: Fix SWITCHTEC_IOCTL_EVENT_IDX_ALL flags overwrite

In the ioctl_event_ctl() SWITCHTEC_IOCTL_EVENT_IDX_ALL case, we call
event_ctl() several times with the same "ctl" struct.  Each call clobbers
ctl.flags, which leads to the problem that we may not actually enable or
disable all events as the user requested.

Preserve the event flag value with a temporary variable.

Fixes: 52eabba5bcdb ("switchtec: Add IOCTLs to the Switchtec driver")
Signed-off-by: Joey Zhang <joey.zhang@microchip.com>
Signed-off-by: Wesley Sheng <wesley.sheng@microchip.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
drivers/pci/switch/switchtec.c