All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ntb: initialize max_mw for Atom before using it
@ 2015-05-13 15:59 Daniel Verkamp
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Verkamp @ 2015-05-13 15:59 UTC (permalink / raw
  To: Jon Mason; +Cc: Dave Jiang, linux-kernel, linux-pci, Daniel Verkamp

Commit ab760a0 (ntb: Adding split BAR support for Haswell platforms)
changed ntb_device's mw from a fixed-size array into a pointer that is
allocated based on limits.max_mw; however, on Atom platforms, max_mw
is not initialized until ntb_device_setup(), which happens after the
allocation.

Fill out max_mw in ntb_atom_detect() to match ntb_xeon_detect(); this
happens before the use of max_mw in the ndev->mw allocation.

Fixes a null pointer dereference on Atom platforms with ntb hardware.

Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/ntb/ntb_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index cd29b10..2f065f0 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -1660,6 +1660,7 @@ static int ntb_atom_detect(struct ntb_device *ndev)
 	u32 ppd;
 
 	ndev->hw_type = BWD_HW;
+	ndev->limits.mw_max = BWD_MAX_MW;
 
 	rc = pci_read_config_dword(ndev->pdev, NTB_PPD_OFFSET, &ppd);
 	if (rc)
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* ntb: initialize max_mw for Atom before using it
@ 2015-06-15 16:39 Verkamp, Daniel
  2015-06-15 17:08 ` [PATCH] " Daniel Verkamp
  0 siblings, 1 reply; 3+ messages in thread
From: Verkamp, Daniel @ 2015-06-15 16:39 UTC (permalink / raw
  To: stable@vger.kernel.org; +Cc: Jiang, Dave, jdmason@kudzu.us

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

Please apply this patch, included in 4.1-rc8, to the stable trees:

  commit ebaad1322d8080a1a8367ec631b345405d9879e2
  ntb: initialize max_mw for Atom before using it

Commit ab760a0 (ntb: Adding split BAR support for Haswell platforms)
caused a regression on Intel Atom systems with ntb hardware (in
particular, Atom S1200); on these systems, the ntb driver dereferences
a null pointer on startup and does not function correctly.

Applies to 4.0.y, 3.19.y, and 3.18.y.

Thanks,
-- Daniel Verkamp

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ntb-initialize-max_mw-for-Atom-before-using-it.patch --]
[-- Type: text/x-patch; name="0001-ntb-initialize-max_mw-for-Atom-before-using-it.patch", Size: 1305 bytes --]

commit ebaad1322d8080a1a8367ec631b345405d9879e2
Author: Daniel Verkamp <daniel.verkamp@intel.com>
Date:   Wed May 13 15:50:04 2015 -0700

    ntb: initialize max_mw for Atom before using it
    
    Commit ab760a0 (ntb: Adding split BAR support for Haswell platforms)
    changed ntb_device's mw from a fixed-size array into a pointer that is
    allocated based on limits.max_mw; however, on Atom platforms, max_mw
    is not initialized until ntb_device_setup(), which happens after the
    allocation.
    
    Fill out max_mw in ntb_atom_detect() to match ntb_xeon_detect(); this
    happens before the use of max_mw in the ndev->mw allocation.
    
    Fixes a null pointer dereference on Atom platforms with ntb hardware.
    
    v2: fix typo (mw_max should be max_mw)
    
    Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
    Acked-by: Dave Jiang <dave.jiang@intel.com>
    Signed-off-by: Jon Mason <jdmason@kudzu.us>

diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index b5c8707..15f9b7c 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -1660,6 +1660,7 @@ static int ntb_atom_detect(struct ntb_device *ndev)
 	u32 ppd;
 
 	ndev->hw_type = BWD_HW;
+	ndev->limits.max_mw = BWD_MAX_MW;
 
 	rc = pci_read_config_dword(ndev->pdev, NTB_PPD_OFFSET, &ppd);
 	if (rc)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ntb: initialize max_mw for Atom before using it
  2015-06-15 16:39 ntb: initialize max_mw for Atom before using it Verkamp, Daniel
@ 2015-06-15 17:08 ` Daniel Verkamp
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Verkamp @ 2015-06-15 17:08 UTC (permalink / raw
  To: stable; +Cc: Daniel Verkamp, Jon Mason

Commit ab760a0 (ntb: Adding split BAR support for Haswell platforms)
changed ntb_device's mw from a fixed-size array into a pointer that is
allocated based on limits.max_mw; however, on Atom platforms, max_mw
is not initialized until ntb_device_setup(), which happens after the
allocation.

Fill out max_mw in ntb_atom_detect() to match ntb_xeon_detect(); this
happens before the use of max_mw in the ndev->mw allocation.

Fixes a null pointer dereference on Atom platforms with ntb hardware.

v2: fix typo (mw_max should be max_mw)

Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
---

Resend with patch inline on Dave's request.

Applies to 4.0.y, 3.19.y, and 3.18.y.

---
 drivers/ntb/ntb_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c
index b5c8707..15f9b7c 100644
--- a/drivers/ntb/ntb_hw.c
+++ b/drivers/ntb/ntb_hw.c
@@ -1660,6 +1660,7 @@ static int ntb_atom_detect(struct ntb_device *ndev)
 	u32 ppd;
 
 	ndev->hw_type = BWD_HW;
+	ndev->limits.max_mw = BWD_MAX_MW;
 
 	rc = pci_read_config_dword(ndev->pdev, NTB_PPD_OFFSET, &ppd);
 	if (rc)
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-15 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-15 16:39 ntb: initialize max_mw for Atom before using it Verkamp, Daniel
2015-06-15 17:08 ` [PATCH] " Daniel Verkamp
  -- strict thread matches above, loose matches on Subject: below --
2015-05-13 15:59 Daniel Verkamp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.