kernel-fxtec-pro1x/drivers
Anton Eidelman ad58ce6cac nvme-multipath: fix ana log nsid lookup when nsid is not found
[ Upstream commit e01f91dff91c7b16a6e3faf2565017d497a73f83 ]

ANA log parsing invokes nvme_update_ana_state() per ANA group desc.
This updates the state of namespaces with nsids in desc->nsids[].

Both ctrl->namespaces list and desc->nsids[] array are sorted by nsid.
Hence nvme_update_ana_state() performs a single walk over ctrl->namespaces:
- if current namespace matches the current desc->nsids[n],
  this namespace is updated, and n is incremented.
- the process stops when it encounters the end of either
  ctrl->namespaces end or desc->nsids[]

In case desc->nsids[n] does not match any of ctrl->namespaces,
the remaining nsids following desc->nsids[n] will not be updated.
Such situation was considered abnormal and generated WARN_ON_ONCE.

However ANA log MAY contain nsids not (yet) found in ctrl->namespaces.
For example, lets consider the following scenario:
- nvme0 exposes namespaces with nsids = [2, 3] to the host
- a new namespace nsid = 1 is added dynamically
- also, a ANA topology change is triggered
- NS_CHANGED aen is generated and triggers scan_work
- before scan_work discovers nsid=1 and creates a namespace, a NOTICE_ANA
  aen was issues and ana_work receives ANA log with nsids=[1, 2, 3]

Result: ana_work fails to update ANA state on existing namespaces [2, 3]

Solution:
Change the way nvme_update_ana_state() namespace list walk
checks the current namespace against desc->nsids[n] as follows:
a) ns->head->ns_id < desc->nsids[n]: keep walking ctrl->namespaces.
b) ns->head->ns_id == desc->nsids[n]: match, update the namespace
c) ns->head->ns_id >= desc->nsids[n]: skip to desc->nsids[n+1]

This enables correct operation in the scenario described above.
This also allows ANA log to contain nsids currently invisible
to the host, i.e. inactive nsids.

Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
Reviewed-by:   James Smart <james.smart@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-10-05 13:09:52 +02:00
..
accessibility
acpi ACPI / CPPC: do not require the _PSD method 2019-10-05 13:09:50 +02:00
amba
android binder: fix possible UAF when freeing buffer 2019-08-04 09:30:53 +02:00
ata libata: add SG safety checks in SFF pio transfers 2019-08-29 08:28:45 +02:00
atm Kconfig: Fix the reference to the IDT77105 Phy driver in the description of ATM_NICSTAR_USE_IDT77105 2019-09-21 07:16:57 +02:00
auxdisplay auxdisplay: panel: need to delete scan_timer when misc_register fails in panel_attach 2019-09-06 10:21:56 +02:00
base base: soc: Export soc_device_register/unregister APIs 2019-10-05 13:09:37 +02:00
bcma
block nbd: add missing config put 2019-10-05 13:09:45 +02:00
bluetooth Bluetooth: btrtl: Additional Realtek 8822CE Bluetooth devices 2019-10-01 08:26:12 +02:00
bus bus: ti-sysc: Simplify cleanup upon failures in sysc_probe() 2019-09-21 07:16:51 +02:00
cdrom cdrom: Fix race condition in cdrom_sysctl_register 2019-04-05 22:33:10 +02:00
char tpm: Fix some name collisions with drivers/char/tpm.h 2019-09-16 08:22:05 +02:00
clk clk: rockchip: Don't yell about bad mmc phases when getting 2019-09-19 09:09:36 +02:00
clocksource clocksource/drivers/exynos_mct: Increase priority over ARM arch timer 2019-07-26 09:14:12 +02:00
connector connector: fix unsafe usage of ->real_parent 2019-03-19 13:12:38 +01:00
cpufreq cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() 2019-08-16 10:12:46 +02:00
cpuidle
crypto crypto: talitos - fix missing break in switch statement 2019-10-01 08:26:02 +02:00
dax mm/huge_memory: fix vmf_insert_pfn_{pmd, pud}() crash, handle unaligned addresses 2019-05-22 07:37:40 +02:00
dca
devfreq PM / devfreq: exynos-bus: Correct clock enable sequence 2019-10-05 13:09:48 +02:00
dio
dma dmaengine: iop-adma: use correct printk format strings 2019-10-05 13:09:42 +02:00
dma-buf dma-buf: Discard old fence_excl on retrying get_fences_rcu for realloc 2019-07-28 08:29:28 +02:00
edac EDAC/amd64: Decode syndrome before translating address 2019-10-05 13:09:48 +02:00
eisa
extcon extcon: arizona: Disable mic detect if running when driver is removed 2019-05-31 06:46:23 -07:00
firewire
firmware firmware: arm_scmi: Check if platform has released shmem before using 2019-10-05 13:09:39 +02:00
fmc
fpga fpga: altera-ps-spi: Fix getting of optional confd gpio 2019-09-21 07:16:53 +02:00
fsi fsi: scom: Don't abort operations for minor errors 2019-09-06 10:22:19 +02:00
gnss gnss: sirf: fix premature wakeup interrupt enable 2019-03-10 07:17:21 +01:00
gpio gpio: fix line flag validation in lineevent_create 2019-09-19 09:09:37 +02:00
gpu drm/nouveau/disp/nv50-: fix center/aspect-corrected scaling 2019-10-01 08:26:12 +02:00
hid HID: Add quirk for HP X500 PIXART OEM mouse 2019-10-01 08:26:02 +02:00
hsi
hv Drivers: hv: kvp: Fix the recent regression caused by incorrect clean-up 2019-09-16 08:21:54 +02:00
hwmon hwmon: (nct7802) Fix wrong detection of in4 presence 2019-08-16 10:12:51 +02:00
hwspinlock
hwtracing intel_th: pci: Add Tiger Lake support 2019-09-06 10:22:18 +02:00
i2c i2c: designware: Synchronize IRQs when unregistering slave client 2019-09-21 07:17:06 +02:00
ide
idle x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
iio iio: adc: stm32-dfsdm: fix data type 2019-09-19 09:09:40 +02:00
infiniband IB/core: Add an unbound WQ type to the new CQ API 2019-10-01 08:26:00 +02:00
input Input: elan_i2c - remove Lenovo Legion Y7000 PnpID 2019-09-21 07:16:41 +02:00
iommu iommu/amd: Fix race in increase_address_space() 2019-09-21 07:17:14 +02:00
ipack
irqchip irqchip/gic-v3-its: Fix LPI release for Multi-MSI devices 2019-10-01 08:26:08 +02:00
isdn mISDN: enforce CAP_NET_RAW for raw sockets 2019-10-05 13:09:31 +02:00
leds led: triggers: Fix a memory leak bug 2019-10-05 13:09:45 +02:00
lightnvm lightnvm: pblk: fix freeing of merged pages 2019-07-26 09:14:09 +02:00
macintosh
mailbox mailbox: handle failed named mailbox channel request 2019-07-31 07:27:07 +02:00
mcb
md md: don't set In_sync if array is frozen 2019-10-05 13:09:38 +02:00
media media: ov9650: add a sanity check 2019-10-05 13:09:50 +02:00
memory memory: tegra: Fix integer overflow on tick value calculation 2019-05-25 18:23:32 +02:00
memstick memstick: Fix error cleanup path of memstick_init 2019-07-31 07:26:59 +02:00
message
mfd mfd: Kconfig: Fix I2C_DESIGNWARE_PLATFORM dependencies 2019-09-16 08:22:04 +02:00
misc VMCI: Release resource if the work is already queued 2019-09-06 10:22:20 +02:00
mmc mmc: sdhci-pci: Add support for Intel CML 2019-09-16 08:22:13 +02:00
mtd mtd: cfi_cmdset_0002: Use chip_good() to retry in do_write_oneword() 2019-10-01 08:26:02 +02:00
mux
net net: lpc-enet: fix printk format strings 2019-10-05 13:09:43 +02:00
nfc st_nci_hci_connectivity_event_received: null check the allocation 2019-08-29 08:28:31 +02:00
ntb
nubus
nvdimm libnvdimm/bus: Fix wait_nvdimm_bus_probe_idle() ABBA deadlock 2019-08-09 17:52:28 +02:00
nvme nvme-multipath: fix ana log nsid lookup when nsid is not found 2019-10-05 13:09:52 +02:00
nvmem nvmem: Use the same permissions for eeprom as for nvmem 2019-09-19 09:09:41 +02:00
of of: overlay: set node fields from properties when add new overlay node 2019-06-09 09:17:24 +02:00
opp
oprofile
parisc parisc: Use implicit space register selection for loading the coherence index of I/O pdirs 2019-06-11 12:20:51 +02:00
parport parport: Fix mem leak in parport_register_dev_model 2019-06-25 11:35:55 +08:00
pci PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it 2019-10-01 08:26:09 +02:00
pcmcia
perf drivers/perf: arm_pmu: Fix failure path in PM notifier 2019-08-06 19:06:55 +02:00
phy phy: renesas: rcar-gen3-usb2: Disable clearing VBUS in over-current 2019-09-21 07:16:42 +02:00
pinctrl pinctrl: sprd: Use define directive for sprd_pinconf_params values 2019-10-01 08:26:07 +02:00
platform platform/x86: pmc_atom: Add CB4063 Beckhoff Automation board to critclk_systems DMI table 2019-09-19 09:09:40 +02:00
pnp
power power: supply: sysfs: ratelimit property read error message 2019-10-01 08:26:07 +02:00
powercap x86/cpu: Sanitize FAM6_ATOM naming 2019-05-14 19:17:53 +02:00
pps drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl 2019-08-04 09:30:56 +02:00
ps3
ptp
pwm Revert "pwm: Set class for exported channels in sysfs" 2019-08-25 10:47:46 +02:00
rapidio drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings 2019-08-06 19:06:52 +02:00
ras RAS/CEC: Fix pfn insertion 2019-07-26 09:14:05 +02:00
regulator regulator: lm363x: Fix off-by-one n_voltages for lm3632 ldo_vpos/ldo_vneg 2019-10-05 13:09:33 +02:00
remoteproc remoteproc: qcom: q6v5-mss: add SCM probe dependency 2019-09-16 08:21:48 +02:00
reset reset: meson-audio-arb: Fix missing .owner setting of reset_controller_dev 2019-05-08 07:21:47 +02:00
rpmsg
rtc rtc: pcf8523: don't return invalid date when battery is low 2019-06-19 08:18:07 +02:00
s390 virtio/s390: fix race on airq_areas[] 2019-09-16 08:22:23 +02:00
sbus
scsi scsi: qla2xxx: Return switch command on a timeout 2019-10-01 08:26:08 +02:00
sfi
sh
siox
slimbus slimbus: fix a potential NULL pointer dereference in of_qcom_slim_ngd_register 2019-05-31 06:46:14 -07:00
sn
soc soc: bcm: brcmstb: biuctrl: Register writes require a barrier 2019-07-14 08:11:03 +02:00
soundwire soundwire: cadence_master: fix definitions for INTSTAT0/1 2019-09-06 10:21:56 +02:00
spi spi: spi-gpio: fix SPI_CS_HIGH capability 2019-09-16 08:22:07 +02:00
spmi
ssb ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit 2019-05-31 06:46:04 -07:00
staging media: imx: mipi csi-2: Don't fail if initial state times-out 2019-10-05 13:09:43 +02:00
target scsi: target/iblock: Fix overrun in WRITE SAME emulation 2019-09-16 08:22:17 +02:00
tc
tee
thermal drivers: thermal: tsens: Don't print error message on -EPROBE_DEFER 2019-06-15 11:54:02 +02:00
thunderbolt thunderbolt: property: Fix a NULL pointer dereference 2019-05-31 06:46:31 -07:00
tty tty/serial: atmel: reschedule TX after RX was started 2019-09-21 07:16:45 +02:00
uio
usb usb: host: xhci-tegra: Set DMA mask correctly 2019-09-21 07:17:04 +02:00
uwb
vfio vfio: Fix WARNING "do not call blocking ops when !TASK_RUNNING" 2019-06-15 11:54:07 +02:00
vhost vhost: make sure log_num < in_num 2019-09-16 08:22:25 +02:00
video video: imsttfb: fix potential NULL pointer dereferences 2019-06-15 11:54:10 +02:00
virt drivers/virt/fsl_hypervisor.c: prevent integer overflow in ioctl 2019-05-16 19:41:31 +02:00
virtio virtio_pci: fix a NULL pointer reference in vp_del_vqs 2019-05-10 17:54:08 +02:00
visorbus
vlynq
vme
w1 w1: fix the resume command API 2019-05-31 06:46:14 -07:00
watchdog watchdog: bcm2835_wdt: Fix module autoload 2019-09-06 10:22:02 +02:00
xen xen/pciback: remove set but not used variable 'old_state' 2019-08-25 10:47:52 +02:00
zorro
Kconfig
Makefile