Commit 1cd1ea56 authored by Tobias Jakobi's avatar Tobias Jakobi Committed by Inki Dae

drm/exynos: g2d: make ioctls more robust

Both exynos_g2d_set_cmdlist_ioctl and exynos_g2d_exec_ioctl don't check
if the G2D was succesfully probe. If that is not the case, then g2d_priv
is just NULL and extracting 'dev' from it in the next step  is going to
produce a kernel oops.

Add proper checks and return ENODEV if the G2D is not available.
Signed-off-by: default avatarTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: default avatarINki Dae <inki.dae@samsung.com>
parent 9d1e25c9
...@@ -1056,7 +1056,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, ...@@ -1056,7 +1056,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
{ {
struct drm_exynos_file_private *file_priv = file->driver_priv; struct drm_exynos_file_private *file_priv = file->driver_priv;
struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
struct device *dev = g2d_priv->dev; struct device *dev;
struct g2d_data *g2d; struct g2d_data *g2d;
struct drm_exynos_g2d_set_cmdlist *req = data; struct drm_exynos_g2d_set_cmdlist *req = data;
struct drm_exynos_g2d_cmd *cmd; struct drm_exynos_g2d_cmd *cmd;
...@@ -1067,6 +1067,10 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, ...@@ -1067,6 +1067,10 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
int size; int size;
int ret; int ret;
if (!g2d_priv)
return -ENODEV;
dev = g2d_priv->dev;
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
...@@ -1223,13 +1227,17 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, ...@@ -1223,13 +1227,17 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
{ {
struct drm_exynos_file_private *file_priv = file->driver_priv; struct drm_exynos_file_private *file_priv = file->driver_priv;
struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
struct device *dev = g2d_priv->dev; struct device *dev;
struct g2d_data *g2d; struct g2d_data *g2d;
struct drm_exynos_g2d_exec *req = data; struct drm_exynos_g2d_exec *req = data;
struct g2d_runqueue_node *runqueue_node; struct g2d_runqueue_node *runqueue_node;
struct list_head *run_cmdlist; struct list_head *run_cmdlist;
struct list_head *event_list; struct list_head *event_list;
if (!g2d_priv)
return -ENODEV;
dev = g2d_priv->dev;
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment