Whamcloud - gitweb
- fixed pssible NULL pointer access in lprocfs_rd_conn_uuid();
authoryury <yury>
Wed, 8 Nov 2006 08:44:25 +0000 (08:44 +0000)
committeryury <yury>
Wed, 8 Nov 2006 08:44:25 +0000 (08:44 +0000)
lustre/obdclass/lprocfs_status.c

index c39f494..3c03070 100644 (file)
@@ -359,12 +359,20 @@ int lprocfs_rd_conn_uuid(char *page, char **start, off_t off, int count,
 {
         struct obd_device *obd = (struct obd_device*)data;
         struct ptlrpc_connection *conn;
+        int rc;
 
         LASSERT(obd != NULL);
-        conn = obd->u.cli.cl_import->imp_connection;
-        LASSERT(conn != NULL);
+
         *eof = 1;
-        return snprintf(page, count, "%s\n", conn->c_remote_uuid.uuid);
+        if (obd->u.cli.cl_import) {
+                conn = obd->u.cli.cl_import->imp_connection;
+                LASSERT(conn != NULL);
+                rc = snprintf(page, count, "%s\n",
+                              conn->c_remote_uuid.uuid);
+        } else {
+                rc = snprintf(page, count, "%s\n", "<none>");
+        }
+        return rc;
 }
 
 static const char *obd_connect_names[] = {