Skip to content

Commit c247cd0

Browse files
semihalf-bartosik-lukaszjnikula
authored andcommitted
drm/i915: fix null pointer dereference
Asus chromebook CX550 crashes during boot on v5.17-rc1 kernel. The root cause is null pointer defeference of bi_next in tgl_get_bw_info() in drivers/gpu/drm/i915/display/intel_bw.c. BUG: kernel NULL pointer dereference, address: 000000000000002e PGD 0 P4D 0 Oops: 0002 [#1] PREEMPT SMP NOPTI CPU: 0 PID: 1 Comm: swapper/0 Tainted: G U 5.17.0-rc1 Hardware name: Google Delbin/Delbin, BIOS Google_Delbin.13672.156.3 05/14/2021 RIP: 0010:tgl_get_bw_info+0x2de/0x510 ... [ 2.554467] Call Trace: [ 2.554467] <TASK> [ 2.554467] intel_bw_init_hw+0x14a/0x434 [ 2.554467] ? _printk+0x59/0x73 [ 2.554467] ? _dev_err+0x77/0x91 [ 2.554467] i915_driver_hw_probe+0x329/0x33e [ 2.554467] i915_driver_probe+0x4c8/0x638 [ 2.554467] i915_pci_probe+0xf8/0x14e [ 2.554467] ? _raw_spin_unlock_irqrestore+0x12/0x2c [ 2.554467] pci_device_probe+0xaa/0x142 [ 2.554467] really_probe+0x13f/0x2f4 [ 2.554467] __driver_probe_device+0x9e/0xd3 [ 2.554467] driver_probe_device+0x24/0x7c [ 2.554467] __driver_attach+0xba/0xcf [ 2.554467] ? driver_attach+0x1f/0x1f [ 2.554467] bus_for_each_dev+0x8c/0xc0 [ 2.554467] bus_add_driver+0x11b/0x1f7 [ 2.554467] driver_register+0x60/0xea [ 2.554467] ? mipi_dsi_bus_init+0x16/0x16 [ 2.554467] i915_init+0x2c/0xb9 [ 2.554467] ? mipi_dsi_bus_init+0x16/0x16 [ 2.554467] do_one_initcall+0x12e/0x2b3 [ 2.554467] do_initcall_level+0xd6/0xf3 [ 2.554467] do_initcalls+0x4e/0x79 [ 2.554467] kernel_init_freeable+0xed/0x14d [ 2.554467] ? rest_init+0xc1/0xc1 [ 2.554467] kernel_init+0x1a/0x120 [ 2.554467] ret_from_fork+0x1f/0x30 [ 2.554467] </TASK> ... Kernel panic - not syncing: Fatal exception Fixes: c64a9a7 ("drm/i915: Update memory bandwidth formulae") Signed-off-by: Łukasz Bartosik <[email protected]> Reviewed-by: Radhakrishna Sripada <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 11c7faa commit c247cd0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/gpu/drm/i915/display/intel_bw.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,17 @@ static int tgl_get_bw_info(struct drm_i915_private *dev_priv, const struct intel
404404
int clpchgroup;
405405
int j;
406406

407-
if (i < num_groups - 1)
408-
bi_next = &dev_priv->max_bw[i + 1];
409-
410407
clpchgroup = (sa->deburst * qi.deinterleave / num_channels) << i;
411408

412-
if (i < num_groups - 1 && clpchgroup < clperchgroup)
413-
bi_next->num_planes = (ipqdepth - clpchgroup) / clpchgroup + 1;
414-
else
415-
bi_next->num_planes = 0;
409+
if (i < num_groups - 1) {
410+
bi_next = &dev_priv->max_bw[i + 1];
411+
412+
if (clpchgroup < clperchgroup)
413+
bi_next->num_planes = (ipqdepth - clpchgroup) /
414+
clpchgroup + 1;
415+
else
416+
bi_next->num_planes = 0;
417+
}
416418

417419
bi->num_qgv_points = qi.num_points;
418420
bi->num_psf_gv_points = qi.num_psf_points;

0 commit comments

Comments
 (0)