Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] drm/mode-config: NULL deref in drm_mode_config_create_initial_state() --
commit 3c650b069a3fde459caa29f241b53349c01d0fce Author: Maxime Ripard <[email protected]> drm/mode-config: Read out hardware state in drm_mode_config_create_initial_state This commit updates drm_mode_config_create_initial_state() to try reading out the initial hardware state via atomic_sro_readout_state before falling back to allocating pristine states under modeset locks. > diff --git a/drivers/gpu/drm/drm_mode_config.c > b/drivers/gpu/drm/drm_mode_config.c > index c1e993a78702e..d6f92e1a54d24 100644 > --- a/drivers/gpu/drm/drm_mode_config.c > +++ b/drivers/gpu/drm/drm_mode_config.c [ ... ] > @@ -408,6 +395,58 @@ int drm_mode_config_create_initial_state(struct > drm_device *dev) > > return 0; > } > + > +/** > + * drm_mode_config_create_initial_state - Allocates the initial state [ ... ] > +int drm_mode_config_create_initial_state(struct drm_device *dev) > +{ > + struct drm_modeset_acquire_ctx ctx; > + int ret; > + > + /* > + * The initial state is usually created while the device is > + * being initialized and nothing can access it concurrently, > + * but holding all the modeset locks puts the readout, the > + * installation of its result and the creation of the pristine > + * states under the same locking contract as the regular > + * atomic paths. > + */ > + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret); > + > + if (dev->mode_config.funcs->atomic_sro_readout_state) { > + ret = dev->mode_config.funcs->atomic_sro_readout_state(dev); > + if (!ret) > + goto out; > + } [Severity: High] Can dev->mode_config.funcs be NULL when drm_mode_config_create_initial_state() is called? In shmob_drm_modeset_init(), drm_mode_config_create_initial_state() runs before sdev->ddev.mode_config.funcs is assigned: drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c:shmob_drm_modeset_init() { ... ret = drm_mode_config_create_initial_state(dev); if (ret) return ret; drm_kms_helper_poll_init(dev); sdev->ddev.mode_config.min_width = 0; sdev->ddev.mode_config.min_height = 0; sdev->ddev.mode_config.max_width = 4095; sdev->ddev.mode_config.max_height = 4095; sdev->ddev.mode_config.funcs = &shmob_drm_mode_config_funcs; ... } Dereferencing dev->mode_config.funcs without a NULL check causes a NULL pointer dereference during probe on shmob-drm. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11
