Revision 31a55cf145f2e3d74a7488e86bd0b33b64250fce authored by Dave Airlie on 19 March 2015, 04:01:42 UTC, committed by Dave Airlie on 19 March 2015, 04:01:42 UTC
   Some urgent regression fixes to booting failures Exynos DRM occured.

   Summary:
   - Fix two urgent null pointer dereference bugs in case of enabling
     or disabling IOMMU. There was two cases to these issues.
     One is that plane->crtc is accessed by exynos_disable_plane()
     when device tree binding is broken so device driver tries
     to release, which means that the mode set operation isn't invoked yet
     so plane->crtc is still NULL and exynos_disable_plane() will access
     NULL pointer. This issue is fixed by checking if the plane->crtc
     is NULL or not in exynos_disable_plane()

     Other is that fimd_wait_for_vblank() is called to avoid from page fault
     with IOMMU before the ctx object is created. At this time,
     fimd_wait_for_vblank() tries to access ctx->crtc but the ctx->crtc
     is still NULL because exynos_drm_crtc_create() isn't called yet.
     This issue is fixed by creating a crtc object and setting it to
     ctx->crtc prior to fimd_wait_for_vblank() call.

     For more details, you can refer to below an e-mail thread,
     http://www.spinics.net/lists/linux-samsung-soc/msg42436.html

   - Remove unnecessary file not used and fix trivial issues.

* 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: fix the initialization order in FIMD
  drm/exynos: fix typo config name correctly.
  drm/exynos: Check for NULL dereference of crtc
  drm/exynos: IS_ERR() vs NULL bug
  drm/exynos: remove unused files
2 parent s 59caeae + cdbfca8
Raw File
decompress.c
/*
 * decompress.c
 *
 * Detect the decompression method based on magic number
 */

#include <linux/decompress/generic.h>

#include <linux/decompress/bunzip2.h>
#include <linux/decompress/unlzma.h>
#include <linux/decompress/unxz.h>
#include <linux/decompress/inflate.h>
#include <linux/decompress/unlzo.h>
#include <linux/decompress/unlz4.h>

#include <linux/types.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/printk.h>

#ifndef CONFIG_DECOMPRESS_GZIP
# define gunzip NULL
#endif
#ifndef CONFIG_DECOMPRESS_BZIP2
# define bunzip2 NULL
#endif
#ifndef CONFIG_DECOMPRESS_LZMA
# define unlzma NULL
#endif
#ifndef CONFIG_DECOMPRESS_XZ
# define unxz NULL
#endif
#ifndef CONFIG_DECOMPRESS_LZO
# define unlzo NULL
#endif
#ifndef CONFIG_DECOMPRESS_LZ4
# define unlz4 NULL
#endif

struct compress_format {
	unsigned char magic[2];
	const char *name;
	decompress_fn decompressor;
};

static const struct compress_format compressed_formats[] __initconst = {
	{ {0x1f, 0x8b}, "gzip", gunzip },
	{ {0x1f, 0x9e}, "gzip", gunzip },
	{ {0x42, 0x5a}, "bzip2", bunzip2 },
	{ {0x5d, 0x00}, "lzma", unlzma },
	{ {0xfd, 0x37}, "xz", unxz },
	{ {0x89, 0x4c}, "lzo", unlzo },
	{ {0x02, 0x21}, "lz4", unlz4 },
	{ {0, 0}, NULL, NULL }
};

decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
				const char **name)
{
	const struct compress_format *cf;

	if (len < 2)
		return NULL;	/* Need at least this much... */

	pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);

	for (cf = compressed_formats; cf->name; cf++) {
		if (!memcmp(inbuf, cf->magic, 2))
			break;

	}
	if (name)
		*name = cf->name;
	return cf->decompressor;
}
back to top