From 34ebeeb7d62808d3d2b46799f26829b7e3f95dbe Mon Sep 17 00:00:00 2001 From: Jeremy Filizetti Date: Thu, 31 May 2012 08:26:28 -0400 Subject: [PATCH] LU-1448 llite: Prevent NULL pointer dereference on disabled OSC When a file system is mounted with a disabled OSC reading the import information from the proc file system can result in a NULL pointer dereference. The Lustre import on a disabled OSC with remain in the LUSTRE_IMP_NEW state and imp_connection will remain NULL. Signed-off-by: Jeremy Filizetti Signed-off-by: Bobi Jam Change-Id: Ia6df51a36efbcd5a7fc7668bb23455b253ae4855 Reviewed-on: http://review.whamcloud.com/2995 Reviewed-by: Liang Zhen Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/obdclass/lprocfs_status.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 9ef31f0..10e98de 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -892,17 +892,18 @@ int lprocfs_rd_import(char *page, char **start, off_t off, int count, libcfs_nid2str(conn->oic_conn->c_peer.nid)); j++; } - cfs_spin_unlock(&imp->imp_lock); - i += snprintf(page + i, count - i, - "]\n" - " current_connection: %s\n" - " connection_attempts: %u\n" - " generation: %u\n" - " in-progress_invalidations: %u\n", - libcfs_nid2str(imp->imp_connection->c_peer.nid), - imp->imp_conn_cnt, - imp->imp_generation, - cfs_atomic_read(&imp->imp_inval_count)); + i += snprintf(page + i, count - i, + "]\n" + " current_connection: %s\n" + " connection_attempts: %u\n" + " generation: %u\n" + " in-progress_invalidations: %u\n", + imp->imp_connection == NULL ? "" : + libcfs_nid2str(imp->imp_connection->c_peer.nid), + imp->imp_conn_cnt, + imp->imp_generation, + cfs_atomic_read(&imp->imp_inval_count)); + cfs_spin_unlock(&imp->imp_lock); lprocfs_stats_collect(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, &ret); if (ret.lc_count != 0) { -- 1.8.3.1