From: Jeremy Filizetti Date: Thu, 31 May 2012 12:26:28 +0000 (-0400) Subject: LU-1448 llite: Prevent NULL pointer dereference on disabled OSC X-Git-Tag: 2.2.59~17 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e15ecfb0f298a1279f569277b2940f30c41446a1 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 --- diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 3b5e5ee..8b6b191 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -987,17 +987,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) {