- char keystr[16];
- char *argv[] = {
- [0] = cache->uc_upcall,
- [1] = cache->uc_name,
- [2] = keystr,
- [3] = NULL
- };
- char *envp[] = {
- [0] = "HOME=/",
- [1] = "PATH=/sbin:/usr/sbin",
- [2] = NULL
- };
- struct timeval start, end;
- int rc;
- ENTRY;
-
- /* There is race condition:
- * "uc_upcall" was changed just after "is_identity_get_disabled" check.
- */
- read_lock(&cache->uc_upcall_rwlock);
- CDEBUG(D_INFO, "The upcall is: '%s'\n", cache->uc_upcall);
-
- if (unlikely(!strcmp(cache->uc_upcall, "NONE"))) {
- CERROR("no upcall set\n");
- GOTO(out, rc = -EREMCHG);
- }
-
- argv[0] = cache->uc_upcall;
- snprintf(keystr, sizeof(keystr), LPU64, entry->ue_key);
-
- do_gettimeofday(&start);
+ char keystr[16];
+ char *argv[] = {
+ [0] = cache->uc_upcall,
+ [1] = cache->uc_name,
+ [2] = keystr,
+ [3] = NULL
+ };
+ char *envp[] = {
+ [0] = "HOME=/",
+ [1] = "PATH=/sbin:/usr/sbin",
+ [2] = NULL
+ };
+ ktime_t start, end;
+ int rc;
+
+ ENTRY;
+ /* There is race condition:
+ * "uc_upcall" was changed just after "is_identity_get_disabled" check.
+ */
+ down_read(&cache->uc_upcall_rwsem);
+ CDEBUG(D_INFO, "The upcall is: '%s'\n", cache->uc_upcall);
+
+ if (unlikely(!strcmp(cache->uc_upcall, "NONE"))) {
+ rc = -EREMCHG;
+ CERROR("%s: extended identity requested for user '%llu' called with 'NONE' upcall: rc = %d\n",
+ cache->uc_name, entry->ue_key, rc);
+ GOTO(out, rc);
+ }
+
+ if (unlikely(cache->uc_upcall[0] == '\0')) {
+ rc = -EREMCHG;
+ CERROR("%s: extended identity requested for user '%llu' called with empty upcall: rc = %d\n",
+ cache->uc_name, entry->ue_key, rc);
+ GOTO(out, rc);
+ }
+
+ argv[0] = cache->uc_upcall;
+ snprintf(keystr, sizeof(keystr), "%llu", entry->ue_key);
+
+ start = ktime_get();