ntb: initialize max_mw for Atom before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
commit ebaad1322d8080a1a8367ec631b345405d9879e2
Author: Daniel Verkamp <daniel.verkamp@xxxxxxxxx>
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@xxxxxxxxx>
    Acked-by: Dave Jiang <dave.jiang@xxxxxxxxx>
    Signed-off-by: Jon Mason <jdmason@xxxxxxxx>

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)

[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]