Bug 116841 - remove_arg_zero not free page at boundary
Summary: remove_arg_zero not free page at boundary
Status: RESOLVED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-21 03:39 UTC by hujunjie
Modified: 2016-04-21 21:13 UTC (History)
0 users

See Also:
Kernel Version: 4.5
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description hujunjie 2016-04-21 03:39:06 UTC
fs/exec.c, remove_arg_zero maybe have a bug:


if (offset == PAGE_SIZE)
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT) - 1);

should be

if (offset == PAGE_SIZE)
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT) - 1);
else if (offset+1 == PAGESIZE && !kaddr[offset])
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT));
Comment 1 hujunjie 2016-04-21 03:46:09 UTC
fs/exec.c, remove_arg_zero maybe have a bug:


if (offset == PAGE_SIZE)
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT) - 1);

should be

if (offset == PAGE_SIZE)
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT) - 1);
else if (offset+1 == PAGESIZE)
  free_arg_page(bprm, (bprm->p >> PAGE_SHIFT));
Comment 2 Andrew Morton 2016-04-21 21:13:48 UTC
Thanks, I queued a fix.  "fs/exec.c: fix minor memory leak".

Note You need to log in before you can comment on or make changes to this bug.