Merge ~mustafakemalgilor/ubuntu/+source/xorg-server:bugfix/lp2007746-ubuntu-focal into ubuntu/+source/xorg-server:ubuntu/focal-devel

Proposed by Mustafa Kemal Gilor
Status: Needs review
Proposed branch: ~mustafakemalgilor/ubuntu/+source/xorg-server:bugfix/lp2007746-ubuntu-focal
Merge into: ubuntu/+source/xorg-server:ubuntu/focal-devel
Diff against target: 85 lines (+63/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/lp2007746-fix-pdev-null-deref.patch (+55/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Ubuntu-X Pending
Review via email: mp+437541@code.launchpad.net

Description of the change

Backported a fix from upstream to focal for the LP issue #2007746:

      * d/p/lp2007746-fix-pdev-null-deref.patch: fix potential pdev NULL deref
        (LP: #2007746)

Please tag & sponsor.

Steps to reproduce/test:

See [ Test Plan ] section of the LP issue #2007746.

To post a comment you must log in.

Unmerged commits

b59d47a... by Mustafa Kemal Gilor

changelog

Signed-off-by: Mustafa Kemal Gilor <email address hidden>

f997dba... by Mustafa Kemal Gilor

  * d/p/lp2007746-fix-pdev-null-deref.patch: fix potential pdev NULL deref
    (LP: #2007746)

Signed-off-by: Mustafa Kemal Gilor <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index a568b1c..ae0bfd1 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+xorg-server (2:1.20.13-1ubuntu1~20.04.6ubuntu1) focal; urgency=medium
7+
8+ * d/p/lp2007746-fix-pdev-null-deref.patch: fix potential pdev null
9+ deref in xf86platformBus.c (LP: #2007746)
10+
11+ -- Mustafa Kemal GILOR <mustafa.gilor@canonical.com> Sat, 18 Feb 2023 15:17:01 +0300
12+
13 xorg-server (2:1.20.13-1ubuntu1~20.04.6) focal-security; urgency=medium
14
15 * SECURITY UPDATE: DeepCopyPointerClasses use-after-free
16diff --git a/debian/patches/lp2007746-fix-pdev-null-deref.patch b/debian/patches/lp2007746-fix-pdev-null-deref.patch
17new file mode 100644
18index 0000000..e51588c
19--- /dev/null
20+++ b/debian/patches/lp2007746-fix-pdev-null-deref.patch
21@@ -0,0 +1,55 @@
22+From 0d93bbfa2cfacbb73741f8bed0e32fa1a656b928 Mon Sep 17 00:00:00 2001
23+From: Povilas Kanapickas <povilas@radix.lt>
24+Date: Fri, 26 Mar 2021 00:51:02 +0200
25+Subject: [PATCH] xfree86: Fix potentially NULL reference to platform device's
26+ PCI device
27+MIME-Version: 1.0
28+Content-Type: text/plain; charset=UTF-8
29+Content-Transfer-Encoding: 8bit
30+
31+xf86_platform_devices[i].pdev may be NULL in cases we fail to parse the
32+busid in config_udev_odev_setup_attribs() (see also [1], [2]) such as
33+when udev does not give use ID_PATH. This in turn leads to
34+platform_find_pci_info() being not called and pdev being NULL.
35+
36+[1]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/993
37+[2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1076
38+
39+Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
40+Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
41+---
42+ hw/xfree86/common/xf86platformBus.c | 10 ++++++----
43+ hw/xfree86/os-support/linux/lnx_platform.c | 3 +++
44+ 2 files changed, 9 insertions(+), 4 deletions(-)
45+
46+--- a/hw/xfree86/common/xf86platformBus.c
47++++ b/hw/xfree86/common/xf86platformBus.c
48+@@ -365,10 +365,12 @@
49+ break;
50+ case BUS_PCI:
51+ for (i = 0; i < xf86_num_platform_devices; i++) {
52+- if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
53+- entity->bus.id.pci)) {
54+- dev = &xf86_platform_devices[i];
55+- break;
56++ if (xf86_platform_devices[i].pdev) {
57++ if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
58++ entity->bus.id.pci)) {
59++ dev = &xf86_platform_devices[i];
60++ break;
61++ }
62+ }
63+ }
64+ break;
65+--- a/hw/xfree86/os-support/linux/lnx_platform.c
66++++ b/hw/xfree86/os-support/linux/lnx_platform.c
67+@@ -101,6 +101,9 @@
68+ bustype = StringToBusType(busid, &id);
69+ if (bustype == BUS_PCI) {
70+ struct pci_device *pPci = device->pdev;
71++ if (!pPci)
72++ return FALSE;
73++
74+ if (xf86ComparePciBusString(busid,
75+ ((pPci->domain << 8)
76+ | pPci->bus),
77diff --git a/debian/patches/series b/debian/patches/series
78index 8713b8a..145813b 100644
79--- a/debian/patches/series
80+++ b/debian/patches/series
81@@ -47,3 +47,4 @@ CVE-2022-46344-1.patch
82 CVE-2022-46344-2.patch
83 CVE-2022-4283.patch
84 CVE-2023-0494.patch
85+lp2007746-fix-pdev-null-deref.patch

Subscribers

People subscribed via source and target branches