]> git.baikalelectronics.ru Git - kernel.git/commit
drm/rockchip: fix wrong pitch/size using on gem
authorMark Yao <mark.yao@rock-chips.com>
Wed, 23 Sep 2015 04:34:34 +0000 (12:34 +0800)
committerMark Yao <mark.yao@rock-chips.com>
Thu, 21 Jan 2016 01:14:05 +0000 (09:14 +0800)
commit7bfbac73ac3a0e1a866013d17c0a7758fce09523
tree08a8d1c55b554360c44dee4adb50c7e0ef2d43cb
parentd88de1e32127502c0521af99807aefd040636f17
drm/rockchip: fix wrong pitch/size using on gem

args->pitch and args->size may not be set by userspace, sometimes
userspace only malloc args and not memset args to zero, then
args->pitch and args->size is random, it is very danger to use
pitch/size on gem.

pitch's type is u32, and min_pitch's type is int, example,
pitch is 0xffffffff, then pitch < min_pitch return true, then gem will
alloc very very big bufffer, it would eat all the memory and cause kernel
crash.

Stop using pitch/size from args, calc them from other args.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
drivers/gpu/drm/rockchip/rockchip_drm_gem.c