[PATCH-next] sched: Fix Dereference after null check

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

 



The group_cfs_rq derefrence the 'se' variable that could
be passed as NULL pointer. Fix this by adding a check
against the sched entity 'se' before the derefrence.

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

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 161b92aa1c79..9be6cdba351d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7080,7 +7080,8 @@ static struct task_struct *pick_task_fair(struct rq *rq)
 		}
 
 		se = pick_next_entity(cfs_rq, curr);
-		cfs_rq = group_cfs_rq(se);
+		if (se)
+			cfs_rq = group_cfs_rq(se);
 	} while (cfs_rq);
 
 	return task_of(se);
-- 
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