[PATCH-next] sched: Fix Null pointer derefrence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'curr' variable could be NULL and derefrenced by
pick_next_entity. Fix this by adding a check that prevent
the invocation of pick_next_entity with a NULL passed argument.

Addresses-Coverity: ("Explicit null dereferenced")
Signed-off-by: Khaled ROMDHANI <khaledromdhani216@xxxxxxxxx>
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 161b92aa1c79..490948df94fe 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7075,7 +7075,7 @@ static struct task_struct *pick_task_fair(struct rq *rq)
 			else
 				curr = NULL;
 
-			if (unlikely(check_cfs_rq_runtime(cfs_rq)))
+			if (unlikely(check_cfs_rq_runtime(cfs_rq) || !curr))
 				goto again;
 		}
 
-- 
2.17.1




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux