VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Varad Gautam <varad.gautam@suse.com> 2021-05-22 17:41:49 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-05-22 15:09:07 -1000 commit: a11ddb37bf367e6b5239b95ca759e5389bb46048 parent: f10628d2f613195132532e0fbda439eeed8d12a2
Commit Summary:
ipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry
Diffstat:
1 file changed, 4 insertions, 2 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 8031464ed4ae..4e4e61111500 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1004,12 +1004,14 @@ static inline void __pipelined_op(struct wake_q_head *wake_q,
 				  struct mqueue_inode_info *info,
 				  struct ext_wait_queue *this)
 {
+	struct task_struct *task;
+
 	list_del(&this->list);
-	get_task_struct(this->task);
+	task = get_task_struct(this->task);
 
 	/* see MQ_BARRIER for purpose/pairing */
 	smp_store_release(&this->state, STATE_READY);
-	wake_q_add_safe(wake_q, this->task);
+	wake_q_add_safe(wake_q, task);
 }
 
 /* pipelined_send() - send a message directly to the task waiting in