Re: [PATCH 1/1] EDAC, sb_edac: Fix out of bound write during DIMM configuration on KNL

2018-02-23 Thread Borislav Petkov
On Thu, Feb 22, 2018 at 04:18:13PM +0100, Anna Karbownik wrote:
> From: akarbown 
> 
> In one of the previous patches we decreased NUM_CHANNELS from 8 to 4, but

We say which patch it was.

Anyway, corrected and applied the below, thanks.

---
From: Anna Karbownik 
Date: Thu, 22 Feb 2018 16:18:13 +0100
Subject: [PATCH] EDAC, sb_edac: Fix out of bound writes during DIMM
 configuration on KNL

Commit

  3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")

decreased NUM_CHANNELS from 8 to 4, but this is not enough for Knights
Landing which supports up to 6 channels.

This caused out-of-bounds writes to pvt->mirror_mode and pvt->tolm
variables which don't pay critical role on KNL code path, so the memory
corruption wasn't causing any visible driver failures.

The easiest way of fixing it is to change NUM_CHANNELS to 6. Do that.

An alternative solution would be to restructure the KNL part of the
driver to 2MC/3channel representation.

Reported-by: Dan Carpenter 
Signed-off-by: Anna Karbownik 
Cc: Mauro Carvalho Chehab 
Cc: Tony Luck 
Cc: jim.m.s...@intel.com
Cc: krzysztof.palisw...@intel.com
Cc: lukasz.odzi...@intel.com
Cc: qiuxu.z...@intel.com
Cc: linux-edac 
Cc: 
Fixes: 3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")
Link: 
http://lkml.kernel.org/r/1519312693-4789-1-git-send-email-anna.karbow...@intel.com
[ Massage commit message. ]
Signed-off-by: Borislav Petkov 
---
 drivers/edac/sb_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index f34430f99fd8..872100215ca0 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -279,7 +279,7 @@ static const u32 correrrthrsld[] = {
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4   /* Max channels per MC */
+#define NUM_CHANNELS   6   /* Max channels per MC */
 #define MAX_DIMMS  3   /* Max DIMMS per channel */
 #define KNL_MAX_CHAS   38  /* KNL max num. of Cache Home Agents */
 #define KNL_MAX_CHANNELS   6   /* KNL max num. of PCI channels */
-- 
2.13.0

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH 1/1] EDAC, sb_edac: Fix out of bound write during DIMM configuration on KNL

2018-02-23 Thread Borislav Petkov
On Thu, Feb 22, 2018 at 04:18:13PM +0100, Anna Karbownik wrote:
> From: akarbown 
> 
> In one of the previous patches we decreased NUM_CHANNELS from 8 to 4, but

We say which patch it was.

Anyway, corrected and applied the below, thanks.

---
From: Anna Karbownik 
Date: Thu, 22 Feb 2018 16:18:13 +0100
Subject: [PATCH] EDAC, sb_edac: Fix out of bound writes during DIMM
 configuration on KNL

Commit

  3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")

decreased NUM_CHANNELS from 8 to 4, but this is not enough for Knights
Landing which supports up to 6 channels.

This caused out-of-bounds writes to pvt->mirror_mode and pvt->tolm
variables which don't pay critical role on KNL code path, so the memory
corruption wasn't causing any visible driver failures.

The easiest way of fixing it is to change NUM_CHANNELS to 6. Do that.

An alternative solution would be to restructure the KNL part of the
driver to 2MC/3channel representation.

Reported-by: Dan Carpenter 
Signed-off-by: Anna Karbownik 
Cc: Mauro Carvalho Chehab 
Cc: Tony Luck 
Cc: jim.m.s...@intel.com
Cc: krzysztof.palisw...@intel.com
Cc: lukasz.odzi...@intel.com
Cc: qiuxu.z...@intel.com
Cc: linux-edac 
Cc: 
Fixes: 3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")
Link: 
http://lkml.kernel.org/r/1519312693-4789-1-git-send-email-anna.karbow...@intel.com
[ Massage commit message. ]
Signed-off-by: Borislav Petkov 
---
 drivers/edac/sb_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index f34430f99fd8..872100215ca0 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -279,7 +279,7 @@ static const u32 correrrthrsld[] = {
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4   /* Max channels per MC */
+#define NUM_CHANNELS   6   /* Max channels per MC */
 #define MAX_DIMMS  3   /* Max DIMMS per channel */
 #define KNL_MAX_CHAS   38  /* KNL max num. of Cache Home Agents */
 #define KNL_MAX_CHANNELS   6   /* KNL max num. of PCI channels */
-- 
2.13.0

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


[PATCH 1/1] EDAC, sb_edac: Fix out of bound write during DIMM configuration on KNL

2018-02-22 Thread Anna Karbownik
From: akarbown 

In one of the previous patches we decreased NUM_CHANNELS from 8 to 4, but
it is not enough for Knights Landing which supports up to 6 channels.

This caused unattended writes to pvt->mirror_mode and pvt->tolm variables
which don't pay critical role on KNL code path, so driver was somehow 
functional.

The easiest way of fixing it is to change NUM_CHANNELS to 6.
An alternative solution would be to restructure KNL part of the driver to
2MC/3channel representation.

Fixes: 3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")
Reported-by: Dan Carpenter 
Signed-off-by: Anna Karbownik 
---
 drivers/edac/sb_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index f34430f..8721002 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -279,7 +279,7 @@ static inline int sad_pkg(const struct interleave_pkg 
*table, u32 reg,
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4   /* Max channels per MC */
+#define NUM_CHANNELS   6   /* Max channels per MC */
 #define MAX_DIMMS  3   /* Max DIMMS per channel */
 #define KNL_MAX_CHAS   38  /* KNL max num. of Cache Home Agents */
 #define KNL_MAX_CHANNELS   6   /* KNL max num. of PCI channels */
-- 
1.8.3.1



Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.



[PATCH 1/1] EDAC, sb_edac: Fix out of bound write during DIMM configuration on KNL

2018-02-22 Thread Anna Karbownik
From: akarbown 

In one of the previous patches we decreased NUM_CHANNELS from 8 to 4, but
it is not enough for Knights Landing which supports up to 6 channels.

This caused unattended writes to pvt->mirror_mode and pvt->tolm variables
which don't pay critical role on KNL code path, so driver was somehow 
functional.

The easiest way of fixing it is to change NUM_CHANNELS to 6.
An alternative solution would be to restructure KNL part of the driver to
2MC/3channel representation.

Fixes: 3286d3eb906c ("EDAC, sb_edac: Drop NUM_CHANNELS from 8 back to 4")
Reported-by: Dan Carpenter 
Signed-off-by: Anna Karbownik 
---
 drivers/edac/sb_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index f34430f..8721002 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -279,7 +279,7 @@ static inline int sad_pkg(const struct interleave_pkg 
*table, u32 reg,
  * sbridge structs
  */
 
-#define NUM_CHANNELS   4   /* Max channels per MC */
+#define NUM_CHANNELS   6   /* Max channels per MC */
 #define MAX_DIMMS  3   /* Max DIMMS per channel */
 #define KNL_MAX_CHAS   38  /* KNL max num. of Cache Home Agents */
 #define KNL_MAX_CHANNELS   6   /* KNL max num. of PCI channels */
-- 
1.8.3.1



Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.