diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-01-27 22:13:25 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-01-27 22:13:25 +0000 |
commit | 8ea962a82a421e930bca91cda10b05d1fb6fefa5 (patch) | |
tree | f5c3ed49a318560bd2f173e58dd915854eb86ca4 /sys/dev/pci/drm | |
parent | 199c07c61ddc45b253e07b87fc262969f20d0dcd (diff) |
drm: fix null-ptr-deref in drm_dev_init_release()
From Wang Hai
52e1bf49e3e25358519719284028334cb31ab543 in linux 5.15.y/5.15.17
acf20ed020ffa4d6cc8347e8d356509b95df3cbe in mainline linux
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 654a2a5fa50..a8060c8d39d 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -674,6 +674,7 @@ static int drm_dev_init(struct drm_device *dev, const struct drm_driver *driver, struct device *parent) { + struct inode *inode; int ret; if (!drm_core_init_complete) { @@ -710,13 +711,15 @@ static int drm_dev_init(struct drm_device *dev, if (ret) return ret; - dev->anon_inode = drm_fs_inode_new(); - if (IS_ERR(dev->anon_inode)) { - ret = PTR_ERR(dev->anon_inode); + inode = drm_fs_inode_new(); + if (IS_ERR(inode)) { + ret = PTR_ERR(inode); DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret); goto err; } + dev->anon_inode = inode; + if (drm_core_check_feature(dev, DRIVER_RENDER)) { ret = drm_minor_alloc(dev, DRM_MINOR_RENDER); if (ret) |