Revision 647e82dbf85124697be59a4b4cf00c0d38177dcb authored by Andy Shevchenko on 01 September 2022, 11:34:06 UTC, committed by Hans de Goede on 01 September 2022, 15:51:34 UTC
We have to copy only selected fields from the original resource. Because a PCI device will be removed immediately after getting its resources, we may not use any allocated data, hence we may not copy any pointers. Consider the following scenario: 1/ a caller of p2sb_bar() gets the resource; 2/ the resource has been copied by platform_device_add_data() in order to create a platform device; 3/ the platform device creation will call for the device driver's ->probe() as soon as a match found; 4/ the ->probe() takes given resources (see 2/) and tries to access one of its field, i.e. 'name', in the __devm_ioremap_resource() to create a pretty looking output; 5/ but the 'name' is a dangling pointer because p2sb_bar() removed a PCI device, which 'name' had been copied to the caller's memory. 6/ UAF (Use-After-Free) as a result. Kudos to Mika for the initial analisys of the issue. Fixes: 9745fb07474f ("platform/x86/intel: Add Primary to Sideband (P2SB) bridge support") Reported-by: kernel test robot <oliver.sang@intel.com> Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Link: https://lore.kernel.org/linux-i2c/YvPCbnKqDiL2XEKp@xsang-OptiPlex-9020/ Link: https://lore.kernel.org/linux-i2c/YtjAswDKfiuDfWYs@xsang-OptiPlex-9020/ Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220901113406.65876-1-andriy.shevchenko@linux.intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 5542dfc
File | Mode | Size |
---|---|---|
chips | ||
devices | ||
hyperbus | ||
lpddr | ||
maps | ||
nand | ||
parsers | ||
spi-nor | ||
tests | ||
ubi | ||
Kconfig | -rw-r--r-- | 7.7 KB |
Makefile | -rw-r--r-- | 964 bytes |
ftl.c | -rw-r--r-- | 30.4 KB |
inftlcore.c | -rw-r--r-- | 23.6 KB |
inftlmount.c | -rw-r--r-- | 21.5 KB |
mtd_blkdevs.c | -rw-r--r-- | 12.2 KB |
mtdblock.c | -rw-r--r-- | 8.7 KB |
mtdblock_ro.c | -rw-r--r-- | 1.8 KB |
mtdchar.c | -rw-r--r-- | 27.8 KB |
mtdconcat.c | -rw-r--r-- | 22.0 KB |
mtdcore.c | -rw-r--r-- | 63.3 KB |
mtdcore.h | -rw-r--r-- | 934 bytes |
mtdoops.c | -rw-r--r-- | 11.2 KB |
mtdpart.c | -rw-r--r-- | 19.0 KB |
mtdpstore.c | -rw-r--r-- | 14.5 KB |
mtdsuper.c | -rw-r--r-- | 4.9 KB |
mtdswap.c | -rw-r--r-- | 33.0 KB |
nftlcore.c | -rw-r--r-- | 22.1 KB |
nftlmount.c | -rw-r--r-- | 25.1 KB |
rfd_ftl.c | -rw-r--r-- | 17.9 KB |
sm_ftl.c | -rw-r--r-- | 30.0 KB |
sm_ftl.h | -rw-r--r-- | 2.2 KB |
ssfdc.c | -rw-r--r-- | 11.2 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...