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 |
---|---|---|
b53 | ||
hirschmann | ||
microchip | ||
mv88e6xxx | ||
ocelot | ||
qca | ||
realtek | ||
sja1105 | ||
xrs700x | ||
Kconfig | -rw-r--r-- | 3.4 KB |
Makefile | -rw-r--r-- | 991 bytes |
bcm_sf2.c | -rw-r--r-- | 40.8 KB |
bcm_sf2.h | -rw-r--r-- | 6.0 KB |
bcm_sf2_cfp.c | -rw-r--r-- | 33.3 KB |
bcm_sf2_regs.h | -rw-r--r-- | 14.8 KB |
dsa_loop.c | -rw-r--r-- | 9.7 KB |
dsa_loop.h | -rw-r--r-- | 446 bytes |
dsa_loop_bdinfo.c | -rw-r--r-- | 756 bytes |
lan9303-core.c | -rw-r--r-- | 39.4 KB |
lan9303.h | -rw-r--r-- | 422 bytes |
lan9303_i2c.c | -rw-r--r-- | 2.8 KB |
lan9303_mdio.c | -rw-r--r-- | 4.6 KB |
lantiq_gswip.c | -rw-r--r-- | 64.3 KB |
lantiq_pce.h | -rw-r--r-- | 5.9 KB |
mt7530.c | -rw-r--r-- | 83.4 KB |
mt7530.h | -rw-r--r-- | 24.9 KB |
mv88e6060.c | -rw-r--r-- | 7.5 KB |
mv88e6060.h | -rw-r--r-- | 4.2 KB |
rzn1_a5psw.c | -rw-r--r-- | 26.4 KB |
rzn1_a5psw.h | -rw-r--r-- | 8.0 KB |
vitesse-vsc73xx-core.c | -rw-r--r-- | 35.4 KB |
vitesse-vsc73xx-platform.c | -rw-r--r-- | 4.6 KB |
vitesse-vsc73xx-spi.c | -rw-r--r-- | 5.1 KB |
vitesse-vsc73xx.h | -rw-r--r-- | 752 bytes |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...