NTB: Add Error Handling in ntb_device_setup
authorJon Mason <jon.mason@intel.com>
Mon, 15 Jul 2013 20:23:47 +0000 (13:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Nov 2013 03:05:34 +0000 (12:05 +0900)
commit21720562911f038d7406654e7ea0c171cfac47b8
tree74b97d9062d54027ab47830d3f49d5ca30a9b4a6
parentdad483b78d280665a110591fd418535e0f9791dc
NTB: Add Error Handling in ntb_device_setup

commit 3b12a0d15bd1559e72ad21d9d807fd2a6706f0ab upstream.

If an error is encountered in ntb_device_setup, it is possible that the
spci_cmd isn't populated.  Writes to the offset can result in a NULL
pointer dereference.  This issue is easily encountered by running in
NTB-RP mode, as it currently is not supported and will generate an
error.  To get around this issue, return if an error is encountered
prior to attempting to write to the spci_cmd offset.

Signed-off-by: Jon Mason <jon.mason@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ntb/ntb_hw.c