linux/drivers/misc
Souptick Joarder 62c3270489 misc: mic: scif: Fix error handling path
[ Upstream commit a81072a9c0 ]

Inside __scif_pin_pages(), when map_flags != SCIF_MAP_KERNEL it
will call pin_user_pages_fast() to map nr_pages. However,
pin_user_pages_fast() might fail with a return value -ERRNO.

The return value is stored in pinned_pages->nr_pages. which in
turn is passed to unpin_user_pages(), which expects
pinned_pages->nr_pages >=0, else disaster.

Fix this by assigning pinned_pages->nr_pages to 0 if
pin_user_pages_fast() returns -ERRNO.

Fixes: ba612aa8b4 ("misc: mic: SCIF memory registration and unregistration")
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Link: https://lore.kernel.org/r/1600570295-29546-1-git-send-email-jrdr.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-29 09:55:11 +01:00
..
altera-stapl altera-stapl: altera_get_note: prevent write beyond end of 'key' 2020-03-25 08:06:07 +01:00
c2port
cardreader misc: rtsx: Add short delay after exit from ASPM 2020-05-27 17:37:43 +02:00
cb710
cxl cxl: Fix kobject memleak 2020-08-19 08:14:55 +02:00
echo misc: echo: Remove unnecessary parentheses and simplify check for zero 2020-04-17 10:48:55 +02:00
eeprom eeprom: at24: make spd world-readable again 2019-08-06 19:06:57 +02:00
genwqe misc: genwqe: should return proper error value. 2019-11-20 18:47:31 +01:00
ibmasm
lis3lv02d
lkdtm lkdtm: support llvm-objcopy 2019-07-14 08:11:21 +02:00
mei mei: bus: don't clean driver pointer 2020-07-22 09:32:11 +02:00
mic misc: mic: scif: Fix error handling path 2020-10-29 09:55:11 +01:00
ocxl
sgi-gru
sgi-xp misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa 2020-01-27 14:50:51 +01:00
ti-st
vmw_vmci VMCI: check return value of get_user_pages_fast() for errors 2020-10-29 09:55:08 +01:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c
ad525x_dpot.h
apds990x.c
apds9802als.c
aspeed-lpc-ctrl.c
aspeed-lpc-snoop.c soc: aspeed: Fix snoop_file_poll()'s return type 2020-01-27 14:49:53 +01:00
atmel_tclib.c
atmel-ssc.c misc: atmel-ssc: lock with mutex instead of spinlock 2020-07-22 09:32:12 +02:00
bh1770glc.c
cs5535-mfgpt.c
ds1682.c
dummy-irq.c
enclosure.c scsi: enclosure: Fix stale device oops with hot replug 2020-01-17 19:47:03 +01:00
fsa9480.c
hmc6352.c
hpilo.c
hpilo.h
ibmvmc.c
ibmvmc.h
ics932s401.c
ioc4.c
isl29003.c
isl29020.c
Kconfig
kgdbts.c misc: kgdbts: Fix restrict error 2019-11-20 18:47:31 +01:00
lattice-ecp3-config.c
Makefile
pch_phub.c PCI: Move Rohm Vendor ID to generic list 2020-06-22 09:05:23 +02:00
pci_endpoint_test.c PCI: Add Synopsys endpoint EDDA Device ID 2020-06-22 09:05:24 +02:00
phantom.c
pti.c
qcom-coincell.c
spear13xx_pcie_gadget.c
sram-exec.c
sram.c
sram.h
tifm_7xx1.c
tifm_core.c
tsl2550.c
vexpress-syscfg.c
vmw_balloon.c