···11591159 */11601160int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)11611161{11621162+ unsigned int depth = bprm->recursion_depth;11621163 int try,retval;11631164 struct linux_binfmt *fmt;11641165#ifdef __alpha__···12201219 continue;12211220 read_unlock(&binfmt_lock);12221221 retval = fn(bprm, regs);12221222+ /*12231223+ * Restore the depth counter to its starting value12241224+ * in this call, so we don't have to rely on every12251225+ * load_binary function to restore it on return.12261226+ */12271227+ bprm->recursion_depth = depth;12231228 if (retval >= 0) {12241224- tracehook_report_exec(fmt, bprm, regs);12291229+ if (depth == 0)12301230+ tracehook_report_exec(fmt, bprm, regs);12251231 put_binfmt(fmt);12261232 allow_write_access(bprm->file);12271233 if (bprm->file)