diff mbox

[2/2] modetest: add null check before destory the buffer object

Message ID 1423044952-5861-2-git-send-email-human.hwang@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hyungwon Hwang Feb. 4, 2015, 10:15 a.m. UTC
When setting a plane is turned on without setting a mode, modetest
terminates with segmentation fault like below. So this patch adds
null check for the variable storing the buffer object in set_mode()
which is null in this case.

[ 4759.016695] modetest[619]: unhandled level 2 translation fault (11) at 0x00000000, esr 0x92000006
[ 4759.016959] pgd = ffffffc0b25e1000
[ 4759.017062] [00000000] *pgd=00000000d3492003, *pud=00000000d3492003, *pmd=0000000000000000
[ 4759.017312]
[ 4759.017365] CPU: 0 PID: 619 Comm: modetest Not tainted 3.19.0-rc7-00347-g458583e-dirty #56
[ 4759.024713] Hardware name: XXXXXXX board (DT)
[ 4759.029629] task: ffffffc0b24d5e80 ti: ffffffc0b2a3c000 task.ti: ffffffc0b2a3c000
[ 4759.037071] PC is at 0x404610
[ 4759.039992] LR is at 0x4027f4
[ 4759.042962] pc : [<0000000000404610>] lr : [<00000000004027f4>] pstate: 60000000
[ 4759.050356] sp : 0000007fe65a6f90
[ 4759.053620] x29: 0000007fe65a6f90 x28: 0000000000421060
[ 4759.058912] x27: 000000000041f000 x26: 00000000004226d0
[ 4759.064207] x25: 0000000000421200 x24: 0000000000000006
[ 4759.069502] x23: 000000000040e790 x22: 000000000041f6f0
[ 4759.074797] x21: 0000000000421060 x20: 00000000004216a0
[ 4759.080091] x19: 0000000000000000 x18: 0000000000000000
[ 4759.085386] x17: 000000000041f2c8 x16: 0000000000000000
[ 4495.006841] x15: 0000000000005798 x14: 0000007f93691968
[ 4495.006850] x13: 0000000000005500 x12: 0000000000000005
[ 4495.006855] x11: 16170f12001a1311 x10: 00010004157f1c03
[ 4495.006860] x9 : 000000000000083b x8 : 000000000000003f
[ 4495.006865] x7 : 00000000000018b2 x6 : 00000000004226d0
[ 4495.006870] x5 : 0000000000000000 x4 : 000000000000000a
[ 4495.006875] x3 : 0000000000000000 x2 : 0000000000000001
[ 4495.006880] x1 : 00000000000064b4 x0 : 0000000000000000
[ 4495.006881]
Segmentation fault      (core dumped) ./modetest -P 13:200x200+0+0

Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
---
 tests/modetest/modetest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 6ce8717..5fcf2a4 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1636,7 +1636,8 @@  int main(int argc, char **argv)
 		if (test_cursor)
 			clear_cursors(&dev);
 
-		bo_destroy(dev.mode.bo);
+		if (dev.mode.bo)
+			bo_destroy(dev.mode.bo);
 	}
 
 	free_resources(dev.resources);