Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2653632pxy; Tue, 3 Aug 2021 11:32:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTEqGd/aj60pqmSSYYREPxDBjsHrLLop+7ZUyVYPpvKVsadwigLUtmVZmShIiEW+f4ihc6 X-Received: by 2002:a05:6638:2493:: with SMTP id x19mr20016706jat.102.1628015521441; Tue, 03 Aug 2021 11:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628015521; cv=none; d=google.com; s=arc-20160816; b=Ny+98yJ8iEoyNesme0ghePqk5M1755BUZkDSqsqiyHArnu+Q4bHgErGsM6g2vbs4/+ Qizc8CiYK+u0O2qYoQ0tq/P9WMis4m5eB3x822+6qitEe5ln84Sg2tekiKtGbOIuV3TV zx7jbiChhfqJud9gyEqRgFLmhiBFyMEIK/SOEsZaCZtLJTP6/2DLifcfIhTcQ0J6wvvI kkvUZE1Qhc/jE7E5vlSkz//El9t+dVJ2Ihe+7jLZgOiebmXw4GH7LG6EJK4AXwYiWdx9 wW05utuQ5MFM+Kc4MVCqtSdnAdh2yFqZgqKfmbgFIKllh2byfRx6efs/hMSBPZzfAJVH 4hYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=p5iqjTciOiC6yi4s+mjSx7ItW2TPHDqiCWQgXvzLb4E=; b=lOD8ean8BUNKL5GBv2bv1oVJRD/qicSwNHpItv9mfao8numGL36E+0subCYX53bIyq RVqR1/o6POGUcE5IemFYMmvZ4j/26Ffb/MTMro91bhQeHHiPfKXJBLuz4boq3Ws2W2+/ sfA7B+irBoIZIfQJbPdAr1nSlBmAIztJ865tGtm6icG2l+HpMnu6EbaghXBGdhDO8q2/ n8RVnhxWH3KZEzoNSsB9WDSuNe8OR3G0teoJd6FUP7cDBE1zAQzUpyeY35ipo3dv8jT0 M2oRNOM8CL15byUQIPFXE/7vcb0Lol2AfXnKkiySGPzxWKTQsqA7rel7Zj0hrBs79CL0 BHtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CuorEacK; 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 h5si17844401iol.44.2021.08.03.11.31.49; Tue, 03 Aug 2021 11:32:01 -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=CuorEacK; 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 S238851AbhHCSbL (ORCPT + 99 others); Tue, 3 Aug 2021 14:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238797AbhHCSbK (ORCPT ); Tue, 3 Aug 2021 14:31:10 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FFB8C061757; Tue, 3 Aug 2021 11:30:57 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id o44-20020a17090a0a2fb0290176ca3e5a2fso5977062pjo.1; Tue, 03 Aug 2021 11:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p5iqjTciOiC6yi4s+mjSx7ItW2TPHDqiCWQgXvzLb4E=; b=CuorEacKFE5HZK1zFVR8UkMmhrjl8k3iEMPr5QBr60z+j+HWX5jo5SYGXnJtsEn81u uGsxejzdxy4rRrfMwX/YwCSSSVrjA6OTz/UAcJGqyuM5bipSGyZSzoAUz0GKgbgVHK7x bk/55TQzW/nRN/+sLEZ1AQX3M/hUb8HcZs6GRXgQ9MslnAVSPDkQeCk3Q54dpR5MDMRK ige64fepIcc4UAiaMlKlIMaTOlzOUY15k64te6Mr96bVwdxzR82SEVipHuB6+2bMRTLR VLVQGB18wclKoMiKvZc4Kban8nKlszsuw9qT2WjKNJY5S52VRBxGhbB5E3Dh/U4VvSmy FiAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p5iqjTciOiC6yi4s+mjSx7ItW2TPHDqiCWQgXvzLb4E=; b=aJUhcX3ZVyBIQbfYpHEoi+4VerLJk3jRFnsDika0rp/c8f2bHT7kSRcXmNREQmvAH1 8buKVk/7BOCxUJUGQSVPtPVkag8dLRANx77Fonn/WUk6WmhBRk+aPeGQBpf7vxWk/Nwj /aZFbusqr2eMDxuhUA+ZxDVH/ps2IBu7WHS5dDcLLJPOu3gYGL6bZPv+C5EQB+HDoUw2 UWAjMCKulW5vtDPGUbGIOh3hBiqjXcSJktFf3lWWk6pPTroHcbu84r1/jZUR4TroDQ8O xyN8E2OSZFbh7/g5gbJNYH0+sdlrIE6SbVov77uXqz7mBaZN7zuIU2y+9cRyIWlvi/ZY YqLw== X-Gm-Message-State: AOAM5321BZJ8cXE2UK+D9+KhJs7XlV45Gi1BnB6YP5+YM8OLlATEtrMn GslPqEA+6vSXM6C1H5t94z66Zc8jbBPk8nzwNGE= X-Received: by 2002:a17:90a:b10b:: with SMTP id z11mr5729155pjq.181.1628015457154; Tue, 03 Aug 2021 11:30:57 -0700 (PDT) MIME-Version: 1.0 References: <20210803181135.22298-1-novikov@ispras.ru> In-Reply-To: From: Andy Shevchenko Date: Tue, 3 Aug 2021 21:30:17 +0300 Message-ID: Subject: Re: [PATCH] platform/x86: intel_pmc_core: Fix potential buffer overflows To: Evgeny Novikov Cc: Rajneesh Bhardwaj , David E Box , Hans de Goede , Mark Gross , "David E. Box" , Gayatri Kammela , Platform Driver , Linux Kernel Mailing List , ldv-project@linuxtesting.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 3, 2021 at 9:26 PM Andy Shevchenko wrote: > On Tue, Aug 3, 2021 at 9:21 PM Evgeny Novikov wrote: > > > > It looks like pmc_core_get_low_power_modes() mixes up modes and > > priorities. In addition to invalid behavior, potentially this can > > cause buffer overflows since the driver reads priorities from the > > register and then it uses them as indexes for array lpm_priority > > that can contain 8 elements at most. The patch swaps modes and > > priorities. > > > > Found by Linux Driver Verification project (linuxtesting.org). > > Seems legit. Hold on, but then it follows with another loop where actually it reads modes by priority index. Can you elaborate what exactly is the problem you think? -- With Best Regards, Andy Shevchenko