WSL2-Linux-Kernel/Documentation/driver-api
Marco Pagani 9b4eee8572 fpga: region: add owner module and take its refcount
[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ]

The current implementation of the fpga region assumes that the low-level
module registers a driver for the parent device and uses its owner pointer
to take the module's refcount. This approach is problematic since it can
lead to a null pointer dereference while attempting to get the region
during programming if the parent device does not have a driver.

To address this problem, add a module owner pointer to the fpga_region
struct and use it to take the module's refcount. Modify the functions for
registering a region to take an additional owner module parameter and
rename them to avoid conflicts. Use the old function names for helper
macros that automatically set the module that registers the region as the
owner. This ensures compatibility with existing low-level control modules
and reduces the chances of registering a region without setting the owner.

Also, update the documentation to keep it consistent with the new interface
for registering an fpga region.

Fixes: 0fa20cdfcc ("fpga: fpga-region: device tree control for FPGA")
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Xu Yilun <yilun.xu@intel.com>
Reviewed-by: Russ Weight <russ.weight@linux.dev>
Signed-off-by: Marco Pagani <marpagan@redhat.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20240419083601.77403-1-marpagan@redhat.com
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-16 13:39:38 +02:00
..
80211
acpi
backlight
cxl cxl/registers: Fix Documentation warning 2021-09-07 11:39:02 -07:00
dmaengine Documentation: dmaengine: Correctly describe dmatest with channel unset 2022-01-27 11:05:20 +01:00
driver-model pwm: Changes for v5.14-rc1 2021-07-08 12:18:04 -07:00
early-userspace Documentation: Fix intiramfs script name 2021-07-18 23:48:14 +09:00
firmware firmware: sysfb: Add sysfb_disable() helper function 2022-07-21 21:24:35 +02:00
fpga fpga: region: add owner module and take its refcount 2024-06-16 13:39:38 +02:00
gpio docs: gpio: explain GPIOD_OUT_* values and toggling active low 2021-07-21 15:21:36 +02:00
i3c
iio
md
media media: Documentation: v4l: Rework LP-11 documentation, add callbacks 2021-08-04 14:43:50 +02:00
mei
memory-devices
mmc
mtd
nfc nfc: constify nfc_llc_ops 2021-07-25 09:21:21 +01:00
nvdimm
pci
phy
pldmfw
pm
rapidio
serial
soundwire
surface_aggregator platform-drivers-x86 for v5.14-1 2021-06-30 11:15:39 -07:00
thermal Backmerge remote-tracking branch 'drm/drm-next' into drm-misc-next 2021-07-27 12:48:17 +02:00
usb USB / Thunderbolt patches for 5.14-rc1 2021-07-05 14:16:22 -07:00
xilinx
auxiliary_bus.rst
basics.rst
clk.rst
component.rst
connector.rst
console.rst
dcdbas.rst
devfreq.rst
device-io.rst
device_link.rst
dma-buf.rst
edac.rst
eisa.rst
firewire.rst Documentation: fix firewire.rst ABI file path error 2022-01-27 11:05:21 +01:00
frame-buffer.rst
generic-counter.rst counter: fix docum. build problems after filename change 2023-04-20 12:13:57 +02:00
hsi.rst
i2c.rst
index.rst remove the lightnvm subsystem 2021-08-14 15:54:09 -06:00
infiniband.rst
infrastructure.rst
input.rst
interconnect.rst
io-mapping.rst
io_ordering.rst
ioctl.rst
ipmb.rst
ipmi.rst
isa.rst
isapnp.rst
libata.rst
mailbox.rst
men-chameleon-bus.rst
message-based.rst
misc_devices.rst
miscellaneous.rst
mtdnand.rst
ntb.rst
nvmem.rst
parport-lowlevel.rst
pin-control.rst
pps.rst
ptp.rst
pwm.rst pwm: core: Remove unused devm_pwm_put() 2021-06-30 19:12:19 +02:00
regulator.rst
reset.rst
rfkill.rst
s390-drivers.rst
scsi.rst
slimbus.rst
sm501.rst
spi.rst spi: Update reference to struct spi_controller 2022-12-31 13:14:08 +01:00
switchtec.rst
sync_file.rst
target.rst
uio-howto.rst
vfio-mediated-device.rst
vfio.rst vfio: Introduce a vfio_uninit_group_dev() API call 2021-08-11 09:50:10 -06:00
vme.rst
w1.rst
xillybus.rst
zorro.rst