Skip to content
This repository
Browse code

MOUNT: when processing the mount response, check status before derefe…

…rencing data pointer

If status is non-zero in the mount callback, then the datapointer might be NULL
so we should not dereference it into an exports pointer before we have checked the status.

This would otherwise cause crashes.
  • Loading branch information...
commit 9b6d10641472355ca4b46579219c3e32f5d76e18 1 parent e7d5990
Ronnie Sahlberg authored November 04, 2012

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  lib/libnfs-sync.c
3  lib/libnfs-sync.c
@@ -1147,7 +1147,7 @@ int nfs_link(struct nfs_context *nfs, const char *oldpath, const char *newpath)
1147 1147
 void mount_getexports_cb(struct rpc_context *mount_context, int status, void *data, void *private_data)
1148 1148
 {
1149 1149
 	struct sync_cb_data *cb_data = private_data;
1150  
-	exports export = *(exports *)data;
  1150
+	exports export;
1151 1151
 
1152 1152
 	cb_data->is_finished = 1;
1153 1153
 	cb_data->status = status;
@@ -1158,6 +1158,7 @@ void mount_getexports_cb(struct rpc_context *mount_context, int status, void *da
1158 1158
 		return;
1159 1159
 	}
1160 1160
 
  1161
+	export = *(exports *)data;
1161 1162
 	while (export != NULL) {
1162 1163
 		exports new_export;
1163 1164
 

0 notes on commit 9b6d106

Please sign in to comment.
Something went wrong with that request. Please try again.