aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2012-05-24 13:28:58 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2012-05-27 06:31:11 -0400
commitf07d42ac7f2a7d650125d0cd7a79631c4522edaf (patch)
tree6fb088bc61544d23e8c7eb0d800129c3664cf7f4 /drivers
parent188726ecb66f022e92ec110ca85c62a937184636 (diff)
firewire: core: allocate the low memory region
Prevent userspace applications from allocating low memory address ranges. Otherwise, if some application happens to allocate such a range and intends for a remote node to access it, and if that node also implements SBP-2 (which will become more likely with the upcoming SBP-2 target support), these accesses would be routed by the physical DMA unit to some wrong memory address. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/core-transaction.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 1c4980c32f90..fc2ad654e1ad 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -525,9 +525,10 @@ const struct fw_address_region fw_high_memory_region =
525 { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL, }; 525 { .start = 0x000100000000ULL, .end = 0xffffe0000000ULL, };
526EXPORT_SYMBOL(fw_high_memory_region); 526EXPORT_SYMBOL(fw_high_memory_region);
527 527
528#if 0 528static const struct fw_address_region low_memory_region =
529const struct fw_address_region fw_low_memory_region =
530 { .start = 0x000000000000ULL, .end = 0x000100000000ULL, }; 529 { .start = 0x000000000000ULL, .end = 0x000100000000ULL, };
530
531#if 0
531const struct fw_address_region fw_private_region = 532const struct fw_address_region fw_private_region =
532 { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL, }; 533 { .start = 0xffffe0000000ULL, .end = 0xfffff0000000ULL, };
533const struct fw_address_region fw_csr_region = 534const struct fw_address_region fw_csr_region =
@@ -1189,6 +1190,23 @@ static struct fw_address_handler registers = {
1189 .address_callback = handle_registers, 1190 .address_callback = handle_registers,
1190}; 1191};
1191 1192
1193static void handle_low_memory(struct fw_card *card, struct fw_request *request,
1194 int tcode, int destination, int source, int generation,
1195 unsigned long long offset, void *payload, size_t length,
1196 void *callback_data)
1197{
1198 /*
1199 * This catches requests not handled by the physical DMA unit,
1200 * i.e., wrong transaction types or unauthorized source nodes.
1201 */
1202 fw_send_response(card, request, RCODE_TYPE_ERROR);
1203}
1204
1205static struct fw_address_handler low_memory = {
1206 .length = 0x000100000000ULL,
1207 .address_callback = handle_low_memory,
1208};
1209
1192MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); 1210MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
1193MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); 1211MODULE_DESCRIPTION("Core IEEE1394 transaction logic");
1194MODULE_LICENSE("GPL"); 1212MODULE_LICENSE("GPL");
@@ -1250,6 +1268,7 @@ static int __init fw_core_init(void)
1250 1268
1251 fw_core_add_address_handler(&topology_map, &topology_map_region); 1269 fw_core_add_address_handler(&topology_map, &topology_map_region);
1252 fw_core_add_address_handler(&registers, &registers_region); 1270 fw_core_add_address_handler(&registers, &registers_region);
1271 fw_core_add_address_handler(&low_memory, &low_memory_region);
1253 fw_core_add_descriptor(&vendor_id_descriptor); 1272 fw_core_add_descriptor(&vendor_id_descriptor);
1254 fw_core_add_descriptor(&model_id_descriptor); 1273 fw_core_add_descriptor(&model_id_descriptor);
1255 1274