s390 updates for 6.3-rc3

- Update defconfigs.
 
 - Fix early boot code by adding missing intersection check to prevent
   potential overwriting of the ipl report.
 
 - Fix a use-after-free issue in s390-specific code related to PCI
   resources being retained after hot-unplugging individual functions,
   by removing the resources from the PCI bus's resource list and using
   the zpci_bar_struct's resource pointer directly.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEE3QHqV+H2a8xAv27vjYWKoQLXFBgFAmQULf8ACgkQjYWKoQLX
 FBh2Zwf/QP0r5FHhU9MO5z00DOfXunP4jJcBW18i4owbjDvEGEJxuixE6KklHfPI
 j918vduGI6YuVlhAfAQPPbFH4GWPc8HMlv/HSifWXq+VeDZToSKv9l0rZbE86blC
 qNJs+MHWc9KSbEr2KUfI4/im9ENb5dGO00JLK0sueZKztY9wdVRIU3JVJGQgQSDU
 BUuUMdiEu6ZZI4fatRumZCKO3V6B47sSc0erxDJ8K9xy8zJdSJ4YJR+WsQHoTFE2
 Ap1q8TZz2PQ7hR3qUZy+iGuLWJX7TzyCsEBceRBnm9DGPp3gKfep0u9Dw83oHe5v
 lmo9e34wS62cEGl8Pia+lwLUWYzXZg==
 =hUmN
 -----END PGP SIGNATURE-----

Merge tag 's390-6.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Vasily Gorbik:

 - Update defconfigs

 - Fix early boot code by adding missing intersection check to prevent
   potential overwriting of the ipl report

 - Fix a use-after-free issue in s390-specific code related to PCI
   resources being retained after hot-unplugging individual functions,
   by removing the resources from the PCI bus's resource list and using
   the zpci_bar_struct's resource pointer directly

* tag 's390-6.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390: update defconfigs
  PCI: s390: Fix use-after-free of PCI resources with per-function hotplug
  s390/ipl: add missing intersection check to ipl_report handling
This commit is contained in:
Linus Torvalds 2023-03-17 10:15:53 -07:00
commit e50a80383e
9 changed files with 54 additions and 34 deletions

View File

@ -57,11 +57,19 @@ repeat:
if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_data.start && initrd_data.size && if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_data.start && initrd_data.size &&
intersects(initrd_data.start, initrd_data.size, safe_addr, size)) intersects(initrd_data.start, initrd_data.size, safe_addr, size))
safe_addr = initrd_data.start + initrd_data.size; safe_addr = initrd_data.start + initrd_data.size;
if (intersects(safe_addr, size, (unsigned long)comps, comps->len)) {
safe_addr = (unsigned long)comps + comps->len;
goto repeat;
}
for_each_rb_entry(comp, comps) for_each_rb_entry(comp, comps)
if (intersects(safe_addr, size, comp->addr, comp->len)) { if (intersects(safe_addr, size, comp->addr, comp->len)) {
safe_addr = comp->addr + comp->len; safe_addr = comp->addr + comp->len;
goto repeat; goto repeat;
} }
if (intersects(safe_addr, size, (unsigned long)certs, certs->len)) {
safe_addr = (unsigned long)certs + certs->len;
goto repeat;
}
for_each_rb_entry(cert, certs) for_each_rb_entry(cert, certs)
if (intersects(safe_addr, size, cert->addr, cert->len)) { if (intersects(safe_addr, size, cert->addr, cert->len)) {
safe_addr = cert->addr + cert->len; safe_addr = cert->addr + cert->len;

View File

@ -23,7 +23,6 @@ CONFIG_NUMA_BALANCING=y
CONFIG_MEMCG=y CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y CONFIG_BLK_CGROUP=y
CONFIG_CFS_BANDWIDTH=y CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y CONFIG_CGROUP_FREEZER=y
@ -90,7 +89,6 @@ CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_IOSCHED_BFQ=y CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=m CONFIG_BINFMT_MISC=m
CONFIG_ZSWAP=y CONFIG_ZSWAP=y
CONFIG_ZSMALLOC_STAT=y CONFIG_ZSMALLOC_STAT=y
@ -298,7 +296,6 @@ CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=m CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_TARGET_CLUSTERIP=m
CONFIG_IP_NF_TARGET_ECN=m CONFIG_IP_NF_TARGET_ECN=m
CONFIG_IP_NF_TARGET_TTL=m CONFIG_IP_NF_TARGET_TTL=m
CONFIG_IP_NF_RAW=m CONFIG_IP_NF_RAW=m
@ -340,7 +337,6 @@ CONFIG_BRIDGE_MRP=y
CONFIG_VLAN_8021Q=m CONFIG_VLAN_8021Q=m
CONFIG_VLAN_8021Q_GVRP=y CONFIG_VLAN_8021Q_GVRP=y
CONFIG_NET_SCHED=y CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_HFSC=m CONFIG_NET_SCH_HFSC=m
CONFIG_NET_SCH_PRIO=m CONFIG_NET_SCH_PRIO=m
@ -351,7 +347,6 @@ CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_NETEM=m CONFIG_NET_SCH_NETEM=m
CONFIG_NET_SCH_DRR=m CONFIG_NET_SCH_DRR=m
CONFIG_NET_SCH_MQPRIO=m CONFIG_NET_SCH_MQPRIO=m
@ -363,14 +358,11 @@ CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_SCH_PLUG=m CONFIG_NET_SCH_PLUG=m
CONFIG_NET_SCH_ETS=m CONFIG_NET_SCH_ETS=m
CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_BASIC=m
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_FW=m CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m CONFIG_NET_CLS_U32=m
CONFIG_CLS_U32_PERF=y CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_FLOW=m CONFIG_NET_CLS_FLOW=m
CONFIG_NET_CLS_CGROUP=y CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=m CONFIG_NET_CLS_BPF=m
@ -584,7 +576,7 @@ CONFIG_DIAG288_WATCHDOG=m
CONFIG_FB=y CONFIG_FB=y
CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
# CONFIG_HID is not set # CONFIG_HID_SUPPORT is not set
# CONFIG_USB_SUPPORT is not set # CONFIG_USB_SUPPORT is not set
CONFIG_INFINIBAND=m CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_ACCESS=m CONFIG_INFINIBAND_USER_ACCESS=m
@ -828,6 +820,7 @@ CONFIG_PANIC_ON_OOPS=y
CONFIG_DETECT_HUNG_TASK=y CONFIG_DETECT_HUNG_TASK=y
CONFIG_WQ_WATCHDOG=y CONFIG_WQ_WATCHDOG=y
CONFIG_TEST_LOCKUP=m CONFIG_TEST_LOCKUP=m
CONFIG_DEBUG_PREEMPT=y
CONFIG_PROVE_LOCKING=y CONFIG_PROVE_LOCKING=y
CONFIG_LOCK_STAT=y CONFIG_LOCK_STAT=y
CONFIG_DEBUG_ATOMIC_SLEEP=y CONFIG_DEBUG_ATOMIC_SLEEP=y
@ -843,6 +836,7 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=300
# CONFIG_RCU_TRACE is not set # CONFIG_RCU_TRACE is not set
CONFIG_LATENCYTOP=y CONFIG_LATENCYTOP=y
CONFIG_BOOTTIME_TRACING=y CONFIG_BOOTTIME_TRACING=y
CONFIG_FPROBE=y
CONFIG_FUNCTION_PROFILER=y CONFIG_FUNCTION_PROFILER=y
CONFIG_STACK_TRACER=y CONFIG_STACK_TRACER=y
CONFIG_IRQSOFF_TRACER=y CONFIG_IRQSOFF_TRACER=y
@ -857,6 +851,7 @@ CONFIG_SAMPLES=y
CONFIG_SAMPLE_TRACE_PRINTK=m CONFIG_SAMPLE_TRACE_PRINTK=m
CONFIG_SAMPLE_FTRACE_DIRECT=m CONFIG_SAMPLE_FTRACE_DIRECT=m
CONFIG_SAMPLE_FTRACE_DIRECT_MULTI=m CONFIG_SAMPLE_FTRACE_DIRECT_MULTI=m
CONFIG_SAMPLE_FTRACE_OPS=m
CONFIG_DEBUG_ENTRY=y CONFIG_DEBUG_ENTRY=y
CONFIG_CIO_INJECT=y CONFIG_CIO_INJECT=y
CONFIG_KUNIT=m CONFIG_KUNIT=m

View File

@ -21,7 +21,6 @@ CONFIG_NUMA_BALANCING=y
CONFIG_MEMCG=y CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y CONFIG_BLK_CGROUP=y
CONFIG_CFS_BANDWIDTH=y CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y CONFIG_CGROUP_FREEZER=y
@ -85,7 +84,6 @@ CONFIG_MINIX_SUBPARTITION=y
CONFIG_SOLARIS_X86_PARTITION=y CONFIG_SOLARIS_X86_PARTITION=y
CONFIG_UNIXWARE_DISKLABEL=y CONFIG_UNIXWARE_DISKLABEL=y
CONFIG_IOSCHED_BFQ=y CONFIG_IOSCHED_BFQ=y
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=m CONFIG_BINFMT_MISC=m
CONFIG_ZSWAP=y CONFIG_ZSWAP=y
CONFIG_ZSMALLOC_STAT=y CONFIG_ZSMALLOC_STAT=y
@ -289,7 +287,6 @@ CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_MANGLE=m CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_TARGET_CLUSTERIP=m
CONFIG_IP_NF_TARGET_ECN=m CONFIG_IP_NF_TARGET_ECN=m
CONFIG_IP_NF_TARGET_TTL=m CONFIG_IP_NF_TARGET_TTL=m
CONFIG_IP_NF_RAW=m CONFIG_IP_NF_RAW=m
@ -330,7 +327,6 @@ CONFIG_BRIDGE_MRP=y
CONFIG_VLAN_8021Q=m CONFIG_VLAN_8021Q=m
CONFIG_VLAN_8021Q_GVRP=y CONFIG_VLAN_8021Q_GVRP=y
CONFIG_NET_SCHED=y CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_HFSC=m CONFIG_NET_SCH_HFSC=m
CONFIG_NET_SCH_PRIO=m CONFIG_NET_SCH_PRIO=m
@ -341,7 +337,6 @@ CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_NETEM=m CONFIG_NET_SCH_NETEM=m
CONFIG_NET_SCH_DRR=m CONFIG_NET_SCH_DRR=m
CONFIG_NET_SCH_MQPRIO=m CONFIG_NET_SCH_MQPRIO=m
@ -353,14 +348,11 @@ CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_SCH_PLUG=m CONFIG_NET_SCH_PLUG=m
CONFIG_NET_SCH_ETS=m CONFIG_NET_SCH_ETS=m
CONFIG_NET_CLS_BASIC=m CONFIG_NET_CLS_BASIC=m
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_FW=m CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m CONFIG_NET_CLS_U32=m
CONFIG_CLS_U32_PERF=y CONFIG_CLS_U32_PERF=y
CONFIG_CLS_U32_MARK=y CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_FLOW=m CONFIG_NET_CLS_FLOW=m
CONFIG_NET_CLS_CGROUP=y CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=m CONFIG_NET_CLS_BPF=m
@ -573,7 +565,7 @@ CONFIG_DIAG288_WATCHDOG=m
CONFIG_FB=y CONFIG_FB=y
CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
# CONFIG_HID is not set # CONFIG_HID_SUPPORT is not set
# CONFIG_USB_SUPPORT is not set # CONFIG_USB_SUPPORT is not set
CONFIG_INFINIBAND=m CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_ACCESS=m CONFIG_INFINIBAND_USER_ACCESS=m
@ -795,6 +787,7 @@ CONFIG_RCU_REF_SCALE_TEST=m
CONFIG_RCU_CPU_STALL_TIMEOUT=60 CONFIG_RCU_CPU_STALL_TIMEOUT=60
CONFIG_LATENCYTOP=y CONFIG_LATENCYTOP=y
CONFIG_BOOTTIME_TRACING=y CONFIG_BOOTTIME_TRACING=y
CONFIG_FPROBE=y
CONFIG_FUNCTION_PROFILER=y CONFIG_FUNCTION_PROFILER=y
CONFIG_STACK_TRACER=y CONFIG_STACK_TRACER=y
CONFIG_SCHED_TRACER=y CONFIG_SCHED_TRACER=y
@ -805,6 +798,7 @@ CONFIG_SAMPLES=y
CONFIG_SAMPLE_TRACE_PRINTK=m CONFIG_SAMPLE_TRACE_PRINTK=m
CONFIG_SAMPLE_FTRACE_DIRECT=m CONFIG_SAMPLE_FTRACE_DIRECT=m
CONFIG_SAMPLE_FTRACE_DIRECT_MULTI=m CONFIG_SAMPLE_FTRACE_DIRECT_MULTI=m
CONFIG_SAMPLE_FTRACE_OPS=m
CONFIG_KUNIT=m CONFIG_KUNIT=m
CONFIG_KUNIT_DEBUGFS=y CONFIG_KUNIT_DEBUGFS=y
CONFIG_LKDTM=m CONFIG_LKDTM=m

View File

@ -58,7 +58,7 @@ CONFIG_ZFCP=y
# CONFIG_VMCP is not set # CONFIG_VMCP is not set
# CONFIG_MONWRITER is not set # CONFIG_MONWRITER is not set
# CONFIG_S390_VMUR is not set # CONFIG_S390_VMUR is not set
# CONFIG_HID is not set # CONFIG_HID_SUPPORT is not set
# CONFIG_VIRTIO_MENU is not set # CONFIG_VIRTIO_MENU is not set
# CONFIG_VHOST_MENU is not set # CONFIG_VHOST_MENU is not set
# CONFIG_IOMMU_SUPPORT is not set # CONFIG_IOMMU_SUPPORT is not set

View File

@ -544,8 +544,7 @@ static struct resource *__alloc_res(struct zpci_dev *zdev, unsigned long start,
return r; return r;
} }
int zpci_setup_bus_resources(struct zpci_dev *zdev, int zpci_setup_bus_resources(struct zpci_dev *zdev)
struct list_head *resources)
{ {
unsigned long addr, size, flags; unsigned long addr, size, flags;
struct resource *res; struct resource *res;
@ -581,7 +580,6 @@ int zpci_setup_bus_resources(struct zpci_dev *zdev,
return -ENOMEM; return -ENOMEM;
} }
zdev->bars[i].res = res; zdev->bars[i].res = res;
pci_add_resource(resources, res);
} }
zdev->has_resources = 1; zdev->has_resources = 1;
@ -590,17 +588,23 @@ int zpci_setup_bus_resources(struct zpci_dev *zdev,
static void zpci_cleanup_bus_resources(struct zpci_dev *zdev) static void zpci_cleanup_bus_resources(struct zpci_dev *zdev)
{ {
struct resource *res;
int i; int i;
pci_lock_rescan_remove();
for (i = 0; i < PCI_STD_NUM_BARS; i++) { for (i = 0; i < PCI_STD_NUM_BARS; i++) {
if (!zdev->bars[i].size || !zdev->bars[i].res) res = zdev->bars[i].res;
if (!res)
continue; continue;
release_resource(res);
pci_bus_remove_resource(zdev->zbus->bus, res);
zpci_free_iomap(zdev, zdev->bars[i].map_idx); zpci_free_iomap(zdev, zdev->bars[i].map_idx);
release_resource(zdev->bars[i].res); zdev->bars[i].res = NULL;
kfree(zdev->bars[i].res); kfree(res);
} }
zdev->has_resources = 0; zdev->has_resources = 0;
pci_unlock_rescan_remove();
} }
int pcibios_device_add(struct pci_dev *pdev) int pcibios_device_add(struct pci_dev *pdev)

View File

@ -41,9 +41,7 @@ static int zpci_nb_devices;
*/ */
static int zpci_bus_prepare_device(struct zpci_dev *zdev) static int zpci_bus_prepare_device(struct zpci_dev *zdev)
{ {
struct resource_entry *window, *n; int rc, i;
struct resource *res;
int rc;
if (!zdev_enabled(zdev)) { if (!zdev_enabled(zdev)) {
rc = zpci_enable_device(zdev); rc = zpci_enable_device(zdev);
@ -57,10 +55,10 @@ static int zpci_bus_prepare_device(struct zpci_dev *zdev)
} }
if (!zdev->has_resources) { if (!zdev->has_resources) {
zpci_setup_bus_resources(zdev, &zdev->zbus->resources); zpci_setup_bus_resources(zdev);
resource_list_for_each_entry_safe(window, n, &zdev->zbus->resources) { for (i = 0; i < PCI_STD_NUM_BARS; i++) {
res = window->res; if (zdev->bars[i].res)
pci_bus_add_resource(zdev->zbus->bus, res, 0); pci_bus_add_resource(zdev->zbus->bus, zdev->bars[i].res, 0);
} }
} }

View File

@ -30,8 +30,7 @@ static inline void zpci_zdev_get(struct zpci_dev *zdev)
int zpci_alloc_domain(int domain); int zpci_alloc_domain(int domain);
void zpci_free_domain(int domain); void zpci_free_domain(int domain);
int zpci_setup_bus_resources(struct zpci_dev *zdev, int zpci_setup_bus_resources(struct zpci_dev *zdev);
struct list_head *resources);
static inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus, static inline struct zpci_dev *zdev_from_bus(struct pci_bus *bus,
unsigned int devfn) unsigned int devfn)

View File

@ -76,6 +76,27 @@ struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n)
} }
EXPORT_SYMBOL_GPL(pci_bus_resource_n); EXPORT_SYMBOL_GPL(pci_bus_resource_n);
void pci_bus_remove_resource(struct pci_bus *bus, struct resource *res)
{
struct pci_bus_resource *bus_res, *tmp;
int i;
for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {
if (bus->resource[i] == res) {
bus->resource[i] = NULL;
return;
}
}
list_for_each_entry_safe(bus_res, tmp, &bus->resources, list) {
if (bus_res->res == res) {
list_del(&bus_res->list);
kfree(bus_res);
return;
}
}
}
void pci_bus_remove_resources(struct pci_bus *bus) void pci_bus_remove_resources(struct pci_bus *bus)
{ {
int i; int i;

View File

@ -1438,6 +1438,7 @@ void pci_bus_add_resource(struct pci_bus *bus, struct resource *res,
unsigned int flags); unsigned int flags);
struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
void pci_bus_remove_resources(struct pci_bus *bus); void pci_bus_remove_resources(struct pci_bus *bus);
void pci_bus_remove_resource(struct pci_bus *bus, struct resource *res);
int devm_request_pci_bus_resources(struct device *dev, int devm_request_pci_bus_resources(struct device *dev,
struct list_head *resources); struct list_head *resources);