|
@@ -1370,12 +1370,11 @@ EXPORT_SYMBOL(remove_arg_zero);
|
|
|
*/
|
|
|
int search_binary_handler(struct linux_binprm *bprm)
|
|
|
{
|
|
|
- unsigned int depth = bprm->recursion_depth;
|
|
|
- int try,retval;
|
|
|
+ int try, retval;
|
|
|
struct linux_binfmt *fmt;
|
|
|
|
|
|
/* This allows 4 levels of binfmt rewrites before failing hard. */
|
|
|
- if (depth > 5)
|
|
|
+ if (bprm->recursion_depth > 5)
|
|
|
return -ELOOP;
|
|
|
|
|
|
retval = security_bprm_check(bprm);
|
|
@@ -1396,9 +1395,9 @@ int search_binary_handler(struct linux_binprm *bprm)
|
|
|
if (!try_module_get(fmt->module))
|
|
|
continue;
|
|
|
read_unlock(&binfmt_lock);
|
|
|
- bprm->recursion_depth = depth + 1;
|
|
|
+ bprm->recursion_depth++;
|
|
|
retval = fn(bprm);
|
|
|
- bprm->recursion_depth = depth;
|
|
|
+ bprm->recursion_depth--;
|
|
|
if (retval >= 0) {
|
|
|
put_binfmt(fmt);
|
|
|
allow_write_access(bprm->file);
|