Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1453119pxj; Sat, 15 May 2021 15:38:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3iHsOpdUz8xMEJljyo9TOoLeRNxXghyzGbUvEuSoPv1+E61S8iP90ULkdLvyR2rgZD3kf X-Received: by 2002:a05:6402:487:: with SMTP id k7mr32471606edv.315.1621118327185; Sat, 15 May 2021 15:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621118327; cv=none; d=google.com; s=arc-20160816; b=FvvtsKmXh2nmnw+jSY99nrP3NKlJrMSKTKUsVHtUFZxDBRlkgAH6AalEGdp9d8Eg7F 0mLwR9x8DThdCUqDjHFmuT6Lyw7uHLuMuuhxf89ADUtI1b7xJtFvrIi8+P7qDmFVmZ2s aef5MrepLJqVMoTbO5qJqoR4WIP0bYFBUrEl/R+T/X718MNOU6zazqfQRFjbeZX6yxqZ 9VNzlrXA0UP5AX3fOJb9RKBGeMV81M6+WgTpyh9+0NKYCpKRRlud42iA+LYW1KNNHU/d 3mh+eWMoa49M6UwThPz7pGt44M0q9BSTGbSgVSgxOpBwX4QqMi1z+GudmAYGKH1kpBjr taMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=pE29kkTNVgaqIoZ2qWVYXC1cONHAz+tF4/QgcXzl/dc=; b=AEhALP4MuCufhRKmz2OZFQdhbbG4Cvjcp4vRrBXd/awVD9qcoXndiJMZsdGl+AMBnk HNJ0FOB835vDULoYf+r+1OITgfx6LimJOr+8PGT3YEZDFiytYjNg5Lnz9TTmLIFA9Q3G MF0GugrxITvj5zhJr2+ZGECdHlZ9i6l5Fml+8T3Gbag7pNhfm1WgIXcRClb8g/BA6nCb Udo41ounn7E4GIVUGb9d0TydYGG5cPm+PqejrubMhUiBkR+QHDgM3k2KDQfqNYC9QrDi jcJT225XKveVHsWPOocohnYCXVzRnQjeBja0kLD5iFZuPASyIFfg5U+4snILj/1xK8e+ gyzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V3UCUnhG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz8si9844822ejc.547.2021.05.15.15.38.24; Sat, 15 May 2021 15:38:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V3UCUnhG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233110AbhEOQs6 (ORCPT + 99 others); Sat, 15 May 2021 12:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbhEOQs5 (ORCPT ); Sat, 15 May 2021 12:48:57 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A68DC061573; Sat, 15 May 2021 09:47:43 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id s8so2116620wrw.10; Sat, 15 May 2021 09:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pE29kkTNVgaqIoZ2qWVYXC1cONHAz+tF4/QgcXzl/dc=; b=V3UCUnhGCXj3vVY/uPBwCbSa1dYDyw0W5O/V4tjSLOvku38JRvJdqgNL/9/D7qYmW1 SSYZHN9QoD01yA5Qhh+2j79rapkFjHkRn/KEUppTLgPPvzRiZgf1YXcFtECYXIZU+2X3 vEjbky8yEs+g/8/OGqvTcnoaKmXEkLlakuI09dWT6JKymK0rqFDwPXz2O4IiW1KDMjaR auAXFe/nofwIIl9QIB7AMojn9xx3X9n5BH4bS6yxb31JSmOFfNUVYvF3tBbU94JSbKuh X/yb1s+hqkBywQMeHFe8/cSsJhxnK7mm9Kh7Hc7K0XburYLfXTsjd3jhhkmILvBAsf/T CC9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pE29kkTNVgaqIoZ2qWVYXC1cONHAz+tF4/QgcXzl/dc=; b=YB7O43kEcCXXMp1nk1spzAp6u359upOs34WtBiZh67ef6oEIPIcFpW9OYoOpqq5qmv rZkDLoj8xBIqM6OGVNXoJb3BH5bFakq+bgBD8D33PBa0o6dN/OMTDxhJgcOXh7zAd4Ee OZBBIFHl/93z/9np4WVuqW/I3/P/7IrZKGgDFCfKlgIe0/0wvevoiDlP3yFtLv3MNnU2 VSZmqZBw5BFGrvUmt0iu90DC7do3wslNm/34pkOosqLWkc3p9CtZeU0Fty9vDHpoVVrM EwNdD9KnJ75AT7LtxGVSSSWnuBwYnsnHVWqCHaHvKadJcHRKHvJdWjDxygGPscl/7TS8 0EYg== X-Gm-Message-State: AOAM533Q1HhOy4KX1+ATQNvSKmSmob55K+uZY7D7rm5UUdaX8FWE0l5i sHRm9+cVWb/N5q6+bqx9XRo= X-Received: by 2002:a5d:534d:: with SMTP id t13mr65166806wrv.153.1621097261791; Sat, 15 May 2021 09:47:41 -0700 (PDT) Received: from localhost.localdomain ([197.240.82.148]) by smtp.gmail.com with ESMTPSA id k11sm10136810wrm.62.2021.05.15.09.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 09:47:41 -0700 (PDT) From: Khaled ROMDHANI To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Cc: Khaled ROMDHANI , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH-next] sched: Fix Null pointer derefrence Date: Sat, 15 May 2021 17:46:45 +0100 Message-Id: <20210515164645.22849-1-khaledromdhani216@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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