From 15bcdef59e147dd469bac26f9e7befb6b6c1027d Mon Sep 17 00:00:00 2001 From: Josh Boyer Date: Tue, 10 Nov 2015 08:46:29 -0500 Subject: [PATCH] Fix incorrect size calculations in megaraid with 64K pages (rhbz 1269300) --- kernel.spec | 4 ++ ...Do-not-use-PAGE_SIZE-for-max_sectors.patch | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 megaraid_sas-Do-not-use-PAGE_SIZE-for-max_sectors.patch diff --git a/kernel.spec b/kernel.spec index 3c688a417..53ff57085 100644 --- a/kernel.spec +++ b/kernel.spec @@ -605,6 +605,9 @@ Patch550: KVM-x86-work-around-infinite-loop-in-microcode-when-.patch #CVE-2015-8104 rhbz 1278496 1279691 Patch551: KVM-svm-unconditionally-intercept-DB.patch +#rhbz 1269300 +Patch552: megaraid_sas-Do-not-use-PAGE_SIZE-for-max_sectors.patch + # END OF PATCH DEFINITIONS %endif @@ -2051,6 +2054,7 @@ fi %changelog * Wed Nov 11 2015 Josh Boyer - Linux v4.3 +- Fix incorrect size calculations in megaraid with 64K pages (rhbz 1269300) - CVE-2015-8104 kvm: DoS infinite loop in microcode DB exception (rhbz 1278496 1279691) - CVE-2015-5307 kvm: DoS infinite loop in microcode AC exception (rhbz 1277172 1279688) - Disable Exynos IOMMU as it crashes diff --git a/megaraid_sas-Do-not-use-PAGE_SIZE-for-max_sectors.patch b/megaraid_sas-Do-not-use-PAGE_SIZE-for-max_sectors.patch new file mode 100644 index 000000000..769337dfa --- /dev/null +++ b/megaraid_sas-Do-not-use-PAGE_SIZE-for-max_sectors.patch @@ -0,0 +1,50 @@ +From c6f081c88ab76d5a40365b94c1f5839e099b2b2b Mon Sep 17 00:00:00 2001 +From: "sumit.saxena@avagotech.com" +Date: Thu, 15 Oct 2015 13:40:04 +0530 +Subject: [PATCH] megaraid_sas: Do not use PAGE_SIZE for max_sectors + +Do not use PAGE_SIZE marco to calculate max_sectors per I/O +request. Driver code assumes PAGE_SIZE will be always 4096 which can +lead to wrongly calculated value if PAGE_SIZE is not 4096. This issue +was reported in Ubuntu Bugzilla Bug #1475166. + +Cc: +Signed-off-by: Sumit Saxena +Signed-off-by: Kashyap Desai +Reviewed-by: Tomas Henzl +Reviewed-by: Martin K. Petersen +Signed-off-by: Martin K. Petersen +--- + drivers/scsi/megaraid/megaraid_sas.h | 2 ++ + drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h +index 20c37541963f..ebf821b94cb6 100644 +--- a/drivers/scsi/megaraid/megaraid_sas.h ++++ b/drivers/scsi/megaraid/megaraid_sas.h +@@ -364,6 +364,8 @@ enum MR_EVT_ARGS { + MR_EVT_ARGS_GENERIC, + }; + ++ ++#define SGE_BUFFER_SIZE 4096 + /* + * define constants for device list query options + */ +diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c +index eaa81e552fd2..a9eb10ebc6ed 100644 +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -4752,7 +4752,7 @@ static int megasas_init_fw(struct megasas_instance *instance) + + + instance->max_sectors_per_req = instance->max_num_sge * +- PAGE_SIZE / 512; ++ SGE_BUFFER_SIZE / 512; + if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) + instance->max_sectors_per_req = tmp_sectors; + +-- +2.4.3 +