From: Greg Kroah-Hartman Date: Thu, 31 Jan 2019 13:15:07 +0000 (+0100) Subject: drm/i915: do not return invalid pointers as a *dentry X-Git-Tag: v5.1-rc1~117^2~11^2~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab1ab0eb0cb64d1c225bdf42bee067f81c87e2a4;p=thirdparty%2Flinux.git drm/i915: do not return invalid pointers as a *dentry When calling debugfs functions, they can now return error values if something went wrong. If that happens, return a NULL as a *dentry to the relay core instead of passing it an illegal pointer. The relay core should be able to handle an illegal pointer, but add this check to be safe. Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: David Airlie Cc: Daniel Vetter Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Greg Kroah-Hartman Reviewed-by: Rodrigo Vivi Signed-off-by: Rodrigo Vivi Link: https://patchwork.freedesktop.org/patch/msgid/20190131131507.GA19807@kroah.com --- diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index b53582c0c6c10..806fdfd7c78a7 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -140,6 +140,9 @@ static struct dentry *create_buf_file_callback(const char *filename, buf_file = debugfs_create_file(filename, mode, parent, buf, &relay_file_operations); + if (IS_ERR(buf_file)) + return NULL; + return buf_file; }