Skip to content

Commit 4ec3d99

Browse files
committed
Merge tag 'v6.12.99' into JH7110_VisionFive2_6.12.y_stable
This is the 6.12.99 stable release
2 parents 8d301ca + 720e8bc commit 4ec3d99

5 files changed

Lines changed: 22 additions & 19 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 12
4-
SUBLEVEL = 98
4+
SUBLEVEL = 99
55
EXTRAVERSION =
66
NAME = Baby Opossum Posse
77

fs/proc/base.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -817,19 +817,21 @@ static const struct file_operations proc_single_file_operations = {
817817
struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode)
818818
{
819819
struct task_struct *task = get_proc_task(inode);
820-
struct mm_struct *mm = ERR_PTR(-ESRCH);
820+
struct mm_struct *mm;
821821

822-
if (task) {
823-
mm = mm_access(task, mode | PTRACE_MODE_FSCREDS);
824-
put_task_struct(task);
822+
if (!task)
823+
return ERR_PTR(-ESRCH);
825824

826-
if (!IS_ERR_OR_NULL(mm)) {
827-
/* ensure this mm_struct can't be freed */
828-
mmgrab(mm);
829-
/* but do not pin its memory */
830-
mmput(mm);
831-
}
832-
}
825+
mm = mm_access(task, mode | PTRACE_MODE_FSCREDS);
826+
put_task_struct(task);
827+
828+
if (IS_ERR(mm))
829+
return mm == ERR_PTR(-ESRCH) ? NULL : mm;
830+
831+
/* ensure this mm_struct can't be freed */
832+
mmgrab(mm);
833+
/* but do not pin its memory */
834+
mmput(mm);
833835

834836
return mm;
835837
}
@@ -2199,7 +2201,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags)
21992201
goto out_notask;
22002202

22012203
mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
2202-
if (IS_ERR_OR_NULL(mm))
2204+
if (IS_ERR(mm))
22032205
goto out;
22042206

22052207
if (!dname_to_vma_addr(dentry, &vm_start, &vm_end)) {

kernel/fork.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,8 +1580,9 @@ struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
15801580
return ERR_PTR(err);
15811581

15821582
mm = get_task_mm(task);
1583-
if (mm && mm != current->mm &&
1584-
!ptrace_may_access(task, mode)) {
1583+
if (!mm) {
1584+
mm = ERR_PTR(-ESRCH);
1585+
} else if (mm != current->mm && !ptrace_may_access(task, mode)) {
15851586
mmput(mm);
15861587
mm = ERR_PTR(-EACCES);
15871588
}

mm/madvise.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,8 +1521,8 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
15211521

15221522
/* Require PTRACE_MODE_READ to avoid leaking ASLR metadata. */
15231523
mm = mm_access(task, PTRACE_MODE_READ_FSCREDS);
1524-
if (IS_ERR_OR_NULL(mm)) {
1525-
ret = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
1524+
if (IS_ERR(mm)) {
1525+
ret = PTR_ERR(mm);
15261526
goto release_task;
15271527
}
15281528

mm/process_vm_access.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ static ssize_t process_vm_rw_core(pid_t pid, struct iov_iter *iter,
201201
}
202202

203203
mm = mm_access(task, PTRACE_MODE_ATTACH_REALCREDS);
204-
if (!mm || IS_ERR(mm)) {
205-
rc = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
204+
if (IS_ERR(mm)) {
205+
rc = PTR_ERR(mm);
206206
/*
207207
* Explicitly map EACCES to EPERM as EPERM is a more
208208
* appropriate error code for process_vw_readv/writev

0 commit comments

Comments
 (0)