summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch
new file mode 100644
index 00000000..1899a818
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.14/0076-target-prevent-NULL-pointer-dereference-in-target_re.patch
@@ -0,0 +1,37 @@
1From 238ac5c459c0204f5134a324f95588aed557b41c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?J=C3=B6rn=20Engel?= <joern@logfs.org>
3Date: Wed, 15 Feb 2012 16:52:11 -0500
4Subject: [PATCH 076/147] target: prevent NULL pointer dereference in
5 target_report_luns
6
7commit 47f1b8803e1e358ebbf4f82bfdb98971c912a2c3 upstream.
8
9transport_kmap_data_sg can return NULL. I never saw this trigger, but
10returning -ENOMEM seems better than a crash. Also removes a pointless
11case while at it.
12
13Signed-off-by: Joern Engel <joern@logfs.org>
14Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
15Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16---
17 drivers/target/target_core_device.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
21index 097178b..f8773ae 100644
22--- a/drivers/target/target_core_device.c
23+++ b/drivers/target/target_core_device.c
24@@ -658,7 +658,9 @@ int target_report_luns(struct se_task *se_task)
25 unsigned char *buf;
26 u32 cdb_offset = 0, lun_count = 0, offset = 8, i;
27
28- buf = (unsigned char *) transport_kmap_data_sg(se_cmd);
29+ buf = transport_kmap_data_sg(se_cmd);
30+ if (!buf)
31+ return -ENOMEM;
32
33 /*
34 * If no struct se_session pointer is present, this struct se_cmd is
35--
361.7.9.4
37