From patchwork Thu Apr 21 16:55:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 12822049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78D11C4332F for ; Thu, 21 Apr 2022 16:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385799AbiDUQ6C (ORCPT ); Thu, 21 Apr 2022 12:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390531AbiDUQ55 (ORCPT ); Thu, 21 Apr 2022 12:57:57 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DD60B1F6 for ; Thu, 21 Apr 2022 09:55:07 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id t4so5160113pgc.1 for ; Thu, 21 Apr 2022 09:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lWrMBaaG06Rl/KqlbUnN7jouLwLObU2X9LsSayAdIEY=; b=RG6zXViEotCrIPi+aqyunCe71vbxFhC/cyC2pcLO6Nnd/L7hctNT+nu9Wd/37midx4 CBEdx7XQHXKUvhBVjHCgDXDtj03gb0gA/FT28uXFAZtrF6FxQCdcvqGjFgu2goVERUa1 aBLVjrQlm+M+HHOBlhi69kBAheJbgTj97x2Ws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lWrMBaaG06Rl/KqlbUnN7jouLwLObU2X9LsSayAdIEY=; b=qM3Thh3CnPJ4nrfLZxwLa1+CPkc9a9ky+PLAypi74xELR4y8TTj7PtwGJCO9BnWyyY 46B93C0iNQ7yFfCICfcBUGF+LnoLjKso2g6GHgEt2NwqlSAvIUcnQYUfFFhD5WVH4rpC d+EhnaZsmUS8zauqyutYMU0QkEMwbRWI2P2q0XcenXiKjV4s4b9BTiOFHs+OevsAhDwR W6IVDIzItvRuOOv7R8W7bx4YjitXo0G6O0/5k6W0Cf9Cb8r146vvl7PK6qSMwSJhb0Jg ddIglqjVIZ7PySP+KRjVnR9hoE26qD/R6H7/EJQEIm/KZw6TX52Z/BScqtTnOr51Fs4b 5XMw== X-Gm-Message-State: AOAM532IInLvvWBgzTyANzq2Z2rTKVtxC0hnixgzbgGDItBmz3AVsuO4 LqEhhgn1qxj/L75BH5zGX0K0vg== X-Google-Smtp-Source: ABdhPJybFqT9+qbX/fmptKtwh1MKt6C6LFPPlumJnR7fijXXj4514Ft/yXS+m+y8hK+j9Rd4HJauww== X-Received: by 2002:a05:6a00:298e:b0:50c:e384:3a16 with SMTP id cj14-20020a056a00298e00b0050ce3843a16mr610980pfb.71.1650560106692; Thu, 21 Apr 2022 09:55:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u3-20020a626003000000b00505a38fc90bsm24888533pfb.173.2022.04.21.09.55.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 09:55:06 -0700 (PDT) From: Kees Cook To: "Rafael J. Wysocki" Cc: Kees Cook , Daniel Lezcano , Amit Kucheria , Zhang Rui , Srinivas Pandruvada , linux-pm@vger.kernel.org, Joao Moreira , stable@vger.kernel.org, Dan Carpenter , Chuansheng Liu , Jiasheng Jiang , Sumeet Pawnikar , Matthew Garrett , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] thermal: int340x: Fix attr.show callback prototype Date: Thu, 21 Apr 2022 09:55:04 -0700 Message-Id: <20220421165504.3173244-1-keescook@chromium.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1946; h=from:subject; bh=luGT7I33b2VPSU/hRTp4Bzm5YaRlLxElO2D/HiBCrCI=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBiYYxnp8ng8BLmn3BJUCmqYDM28VV2nCxsOVm2zLy+ LJp8UgqJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCYmGMZwAKCRCJcvTf3G3AJlOCD/ 9lztboo9y2dy0mnMoOXHcJOcK/kpeyZf11lTux/iSdVIVqNAWXfmfzQBifo15Bq4PZa9jlNoHJIvpj 2/4/xqH0Wfyr9dMmzYCdUD/tXJMQN9xW61hBX1O+Fn6obddy6jvOEsbFKIlV6W2PmmYn2j3ph0JAvb BAhgnXMb7eLsLGarKzjO55yjay/yDwM176Q4VpOaAAc4+RFYUvZIGhW010OBdwM0ut+WQ4YKdbnest uY5+p44FLL35FwQPREFU1tfg0j0gfJStm6cKA9KnO1uamR7Ds6HSqM4OPzsuAz1MUTBQWgihe0JINA +yarzxWBPEP3/d3SueddXMFyle/JYx6g/NwXYfBTvZr1Amyqmt3hsXDQB+KXuR8JsAqxahrTKDc2pu f+y8bmT60daXrqKckbnxMBQ5HPxmIok8WWWfWw3aVGfoQjxqb2UFYbkPn6f9lWSm3ixb113DSXdNvU 5JF7v8Mm7xFlnb2IYCwTNQ7eojS1+ewl20o/vNJ5xXH7r3g9HVXIXIC08Rkoc0HayOEL+pDqLVQm1m 1hiTd32fHiIPownlJp0LdE+0YhyAJHYa9X2VFnlgsTc8WA87O43yGy2Q0nkD9SiAbaLmR1IAK/6sRv ciQKq7l3+RJse92bmT3I8A4kLndMMZlzjy8c+wTpTW6zKM7wJFMSpu0USUiw== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org Control Flow Integrity (CFI) instrumentation of the kernel noticed that the caller, dev_attr_show(), and the callback, odvp_show(), did not have matching function prototypes, which would cause a CFI exception to be raised. Correct the prototype by using struct device_attribute instead of struct kobj_attribute. Cc: "Rafael J. Wysocki" Cc: Daniel Lezcano Cc: Amit Kucheria Cc: Zhang Rui Cc: Srinivas Pandruvada Cc: linux-pm@vger.kernel.org Reported-and-tested-by: Joao Moreira Link: https://lore.kernel.org/lkml/067ce8bd4c3968054509831fa2347f4f@overdrivepizza.com/ Fixes: 006f006f1e5c ("thermal/int340x_thermal: Export OEM vendor variables") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook --- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 4954800b9850..d97f496bab9b 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -68,7 +68,7 @@ static int evaluate_odvp(struct int3400_thermal_priv *priv); struct odvp_attr { int odvp; struct int3400_thermal_priv *priv; - struct kobj_attribute attr; + struct device_attribute attr; }; static ssize_t data_vault_read(struct file *file, struct kobject *kobj, @@ -311,7 +311,7 @@ static int int3400_thermal_get_uuids(struct int3400_thermal_priv *priv) return result; } -static ssize_t odvp_show(struct kobject *kobj, struct kobj_attribute *attr, +static ssize_t odvp_show(struct device *dev, struct device_attribute *attr, char *buf) { struct odvp_attr *odvp_attr;