aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>2014-07-23 10:57:12 -0400
committerInki Dae <inki.dae@samsung.com>2014-08-04 00:39:28 -0400
commit1cd1ea565f3ece26dff3a94bf73e4f6caae140b9 (patch)
tree45fd7753722b2795c9f81134beed6fb68c664be1
parent9d1e25c9982b97f5f3f2b9c885e823ee58a9fb3d (diff)
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: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Signed-off-by: INki Dae <inki.dae@samsung.com>
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_g2d.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index 4e7d1b667ce8..0d46178f0d89 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -1056,7 +1056,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
1056{ 1056{
1057 struct drm_exynos_file_private *file_priv = file->driver_priv; 1057 struct drm_exynos_file_private *file_priv = file->driver_priv;
1058 struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; 1058 struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
1059 struct device *dev = g2d_priv->dev; 1059 struct device *dev;
1060 struct g2d_data *g2d; 1060 struct g2d_data *g2d;
1061 struct drm_exynos_g2d_set_cmdlist *req = data; 1061 struct drm_exynos_g2d_set_cmdlist *req = data;
1062 struct drm_exynos_g2d_cmd *cmd; 1062 struct drm_exynos_g2d_cmd *cmd;
@@ -1067,6 +1067,10 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data,
1067 int size; 1067 int size;
1068 int ret; 1068 int ret;
1069 1069
1070 if (!g2d_priv)
1071 return -ENODEV;
1072
1073 dev = g2d_priv->dev;
1070 if (!dev) 1074 if (!dev)
1071 return -ENODEV; 1075 return -ENODEV;
1072 1076
@@ -1223,13 +1227,17 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data,
1223{ 1227{
1224 struct drm_exynos_file_private *file_priv = file->driver_priv; 1228 struct drm_exynos_file_private *file_priv = file->driver_priv;
1225 struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; 1229 struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
1226 struct device *dev = g2d_priv->dev; 1230 struct device *dev;
1227 struct g2d_data *g2d; 1231 struct g2d_data *g2d;
1228 struct drm_exynos_g2d_exec *req = data; 1232 struct drm_exynos_g2d_exec *req = data;
1229 struct g2d_runqueue_node *runqueue_node; 1233 struct g2d_runqueue_node *runqueue_node;
1230 struct list_head *run_cmdlist; 1234 struct list_head *run_cmdlist;
1231 struct list_head *event_list; 1235 struct list_head *event_list;
1232 1236
1237 if (!g2d_priv)
1238 return -ENODEV;
1239
1240 dev = g2d_priv->dev;
1233 if (!dev) 1241 if (!dev)
1234 return -ENODEV; 1242 return -ENODEV;
1235 1243