From patchwork Tue Aug 8 15:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1818649 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=PSV7Pvrb; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RKxWX3hmzz1yfh for ; Wed, 9 Aug 2023 01:12:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qTONp-00046w-52; Tue, 08 Aug 2023 15:12:29 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qTONl-00046S-EK for kernel-team@lists.ubuntu.com; Tue, 08 Aug 2023 15:12:25 +0000 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 16F443F078 for ; Tue, 8 Aug 2023 15:12:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1691507545; bh=7y2LuHDXXMaFSfevDgITC2an/uMy2e+Qj/fUnsti4Zo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PSV7Pvrb72WYcyZdF7BBS1PpPs/fbRo0yF8xJR2WuC5+noULyIIKiHa/Odwa/m6fI Vi0T4b64lfJkImP13IHrrxi4AgcDVk6HeJbhTBM+dDacVlY7tpEtzpY+7oM7opv+St BGpGrAPhOKqbYCkWFL/d+POc3SviYcRiLVd80ZvHPAtV+DSdRdoJlPx+ynhOBDvHa8 v0q4Wp7Wvfp5jA04KMSFpZe+hHTEE0MyimdGcd6URh9TSx8jl7BLpAYKjacIMbI07p edIR7aaLI1zWpXARpWOkIouG2erx/bSrBzbGvYa/aLbMPSwAn05bqdP5GvD9YC0rtt kYaLzU2kAIezg== Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-63d062fc6f8so70051466d6.3 for ; Tue, 08 Aug 2023 08:12:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691507543; x=1692112343; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7y2LuHDXXMaFSfevDgITC2an/uMy2e+Qj/fUnsti4Zo=; b=iXSSVKZyYN8OzB2lJ6I0RwOkQppkdENoNr8tY9Jdte9JyzhEnqaoO1pXAAbNQTcyUh P1BtoFqiTCirra4kqv4lG3t30WNFw/nA0HD2T4zVyPhk6eCZJWqvNs/GrNYIjse2IYnL vFUg5d4tqLBj3cS/ILUv3ZiG6CircyH0ihDlf7JXLCH9LppScY5KR/xMOt1slMA0Qv2F Ua/1qk/sGxTAKi5yuP9r6jsUZt3wcUEHu755ZneA9Zly6uZ9w4kmPMq7HnxHsk459KGf Mr1UhZPTDtdzc52yyUUxvaK3j8HncNAH9Yv96c9t8+z7zh4foEjj987r8Rgxal4Ywifs za8g== X-Gm-Message-State: AOJu0YwJ4yVBMyM1vPHodezCiQrR2+NeyVKIt2bcQ3E0ZVko8iof0zSO I8Sj7fTdZYgDkb53Y+O9Azl/NpjrsHt17zJXpTxp6+iCfDLCq6tMw92ZHcOY64p100BxaBMeK/C aHmiiW9G8pgMhYTyUQc002Nsk980LfA3O+bkLPqtrryyhb/mDjw== X-Received: by 2002:a0c:e88b:0:b0:63d:10b2:55ea with SMTP id b11-20020a0ce88b000000b0063d10b255eamr11612986qvo.27.1691507543760; Tue, 08 Aug 2023 08:12:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFatmzAwj+8IK9Dxv4TGPJOIODFkCSKDt0sZcYMr2pfwa4vWt9NCSA+QykqkmlUPWht6j5mVw== X-Received: by 2002:a0c:e88b:0:b0:63d:10b2:55ea with SMTP id b11-20020a0ce88b000000b0063d10b255eamr11612967qvo.27.1691507543471; Tue, 08 Aug 2023 08:12:23 -0700 (PDT) Received: from cache-ubuntu.hsd1.nj.comcast.net ([2601:86:200:98b0:1336:376b:518c:830e]) by smtp.gmail.com with ESMTPSA id c14-20020a0ca9ce000000b0063d2898f210sm3710114qvb.103.2023.08.08.08.12.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Aug 2023 08:12:23 -0700 (PDT) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [SRU][Jammy-OEM-6.0][PATCH 1/1] drm/msm/dpu: Add check for pstates Date: Tue, 8 Aug 2023 11:12:19 -0400 Message-Id: <20230808151219.62674-3-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230808151219.62674-1-yuxuan.luo@canonical.com> References: <20230808151219.62674-1-yuxuan.luo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jiasheng Jiang As kzalloc may fail and return NULL pointer, it should be better to check pstates in order to avoid the NULL pointer dereference. Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Signed-off-by: Jiasheng Jiang Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/514160/ Link: https://lore.kernel.org/r/20221206080236.43687-1-jiasheng@iscas.ac.cn Signed-off-by: Dmitry Baryshkov (cherry picked from commit 93340e10b9c5fc86730d149636e0aa8b47bb5a34) CVE-2023-3220 Signed-off-by: Yuxuan Luo --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 781dcd3fb283..3c2abb058102 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1159,6 +1159,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state); pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL); + if (!pstates) + return -ENOMEM; if (!crtc_state->enable || !crtc_state->active) { DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",