Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp732736lqh; Thu, 28 Mar 2024 14:53:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwPdetC5h50vIOBNyigU0WUCDUlpLOGrFtsVrf2wOvnHVa/zt9fzNXpBan0SdKl5wQlj/caF07FT9OJ+PVxDT8D6B/Va+1nm6Mvbdc1Q== X-Google-Smtp-Source: AGHT+IFBZVzi5WzVAtIEhF7IMKmG5UdLcOVp79XwvWQnbOehCAbiOAS+saw9yNc0jOpnzIMuN74f X-Received: by 2002:a05:622a:386:b0:432:a566:cf72 with SMTP id j6-20020a05622a038600b00432a566cf72mr875108qtx.23.1711662837074; Thu, 28 Mar 2024 14:53:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711662837; cv=pass; d=google.com; s=arc-20160816; b=mH1qwBltYlOnL1B1xVyOuFzvBsd6CD7uSnUwp6q+UTRlSE0fltF/jiGe/kDJQomuzc Z8D1LIBkG/EavkMTWauwrTEC1nOfBarHW7wa9Cd4HI9SPTxFeCoXa86dy4XJh8a89qle 6+Wy9+Usb9fiZqmDA75SI5A7Bg69Tp8QMxNYUqFS5ZK8l49Zshaei4EQMaGSj9+qdcbZ k/dsuGe+Vxp+8H6gGGxRycUhCAHRpw/RAhq8gF/JbN5BE8JxKWMHFTqdJs1qL3yK6CW/ ShbamI4wlMxvlyOgILChKv335teB8NPwo7cXIurwLhL0lE2k2U/kw3cxy5S/y+d8e+QH gMbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=sGEqjNqrvmsv/rKMTBJtEC1DNvG9GXaPV0NCd4IjXl4=; fh=pKsgSWZpizO3Qaoh0ol1sc/ls7ljpVsT7VLFVAhcQxs=; b=qX6sITCpzFEYu7XN6fAfg/Uf+Uurld3ttngHRirD/KSdJR/RDl5lCknwgUlqW+JNJ7 JP/LCGfzQYkgS2/3EGEXSr4PnGVeaNZ5q5NX+d6gyIL1roctDkQnaGqQCwzAtnTm90JS pzKuZ6EsLWLyuNfxFWVgZl1Tp5HonaRQPWNHRx1TnAM3cuQf2dRIUHcvjx71wU9m0br+ nu9W25ATQNkNPSCr7j/zyRO6rDfsMQkVJBlDZl74+JiFQlycQyccHbFI34Ae/PIdQwiN ZlNO8hnIjQ0+nnkSPdMh187zLnLby4n3TVQ8RJ7snh6NBrAs4MZ74J6cGsGd5Kg1lS96 cIWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VvrkwfpN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-123691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123691-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v20-20020a05622a189400b00430b5fb8eb5si2255154qtc.659.2024.03.28.14.53.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 14:53:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VvrkwfpN; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-123691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123691-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CB7CD1C23578 for ; Thu, 28 Mar 2024 21:53:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CBD213A405; Thu, 28 Mar 2024 21:53:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VvrkwfpN" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9791651B2; Thu, 28 Mar 2024 21:53:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711662830; cv=none; b=rFrbKbr2cBxLLG+raIrteT0PehY5ilQGW3zjiK5U+osR/06p35x2W+I9rWBimqBH3ZuoCR1H2gncuIWmPvUkA7aXkb9MaNj59QHdQV3om75EapzFlWP9XGOTzwQeEfWbUo4YCI7/uvLg9wlRbK+sxEF4HoSeTAC6kcvzbToUT/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711662830; c=relaxed/simple; bh=hllItWoe55/OAq69a/mspkkgXn6x1Ii1x8UHcxndGkg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cSrcapeOHGIBEZP/KpTmQUc/GHMJ5s9xxgV/CKnKURXQGtE8xL8xGu4N/6esKONAXkiHQOOs8K2SMRbj9wKFwP3Q6nlFouyZErU+fI1jtiLlVm7nL4PokCOixIV6WpTUlQ+NOoxrFskKfo/l4JOI5umLq14Uvvx9O+zfPqNIoRE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VvrkwfpN; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711662829; x=1743198829; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=hllItWoe55/OAq69a/mspkkgXn6x1Ii1x8UHcxndGkg=; b=VvrkwfpNftLPxsL0Ael3Cd0V92J4QL2I4hGr7FAXU+2FNlt/qLpIdkKc FdNnvJM3N4uEIe0XDT1oj1u+61x4o36bfGag3729Cb/rwdb9VHrCNaUFH sAl/aKVGzQ3N7BtQMjf3AfNzZ52LYufCxr3ou3yCA36PKHVtfyQGVwJNE cicpjiSpBvLq6c39Mj/j555HRa4dImacmWbSjqoKhH6kIXmdeuOmvirqV nTf3gYvVyxbbIRWzyXLWvTrZKYml9C6BFi/Q5+E2cJAEyTy3w963kJAdt w1ix93LvqCwYLMp5S0vU8iCMvPZJ+JyKz7G96BLz7jXma/PmI0TZrFsAk g==; X-CSE-ConnectionGUID: LSA0tPlfSdaTUUWyVeUs+Q== X-CSE-MsgGUID: jqafTy4CQq6TpKRq3w2uUg== X-IronPort-AV: E=McAfee;i="6600,9927,11027"; a="6708572" X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="6708572" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 14:53:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,162,1708416000"; d="scan'208";a="16825714" Received: from sroy1-mobl1.amr.corp.intel.com (HELO [10.209.99.151]) ([10.209.99.151]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2024 14:53:47 -0700 Message-ID: Date: Thu, 28 Mar 2024 14:53:46 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] platform/x86: panasonic-laptop: fix NULL dereference To: Maxim Korotkov , Kenneth Chan Cc: Len Brown , Henrique de Moraes Holschuh , Harald Welte , Matthew Garrett , Ivan Kapranov , lvc-project@linuxtesting.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240328103518.169604-1-korotkov.maxim.s@gmail.com> Content-Language: en-US From: Kuppuswamy Sathyanarayanan In-Reply-To: <20240328103518.169604-1-korotkov.maxim.s@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/28/24 3:35 AM, Maxim Korotkov wrote: > When initializing the pcc by calling acpi_driver_data(), the "device" > pointer was dereferenced without checking for NULL. This seems like > a logical mistake. > > Added a pointer check to ensure that it is valid > before using it for pcc initialization. > > Found by Security Code and Linux Verification Center(linuxtesting.org) > > Fixes: 709ee531c153 ("panasonic-laptop: add Panasonic Let's Note laptop extras driver v0.94") Since this is a remove function within kernel, is there any change for device being NULL? > Signed-off-by: Maxim Korotkov > --- > drivers/platform/x86/panasonic-laptop.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c > index cf845ee1c7b1..de29758b0384 100644 > --- a/drivers/platform/x86/panasonic-laptop.c > +++ b/drivers/platform/x86/panasonic-laptop.c > @@ -1067,9 +1067,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) > > static void acpi_pcc_hotkey_remove(struct acpi_device *device) > { > - struct pcc_acpi *pcc = acpi_driver_data(device); > + struct pcc_acpi *pcc; > > - if (!device || !pcc) > + if (!device) > + return; > + pcc = acpi_driver_data(device); > + if (!pcc) > return; > > i8042_remove_filter(panasonic_i8042_filter); -- Sathyanarayanan Kuppuswamy Linux Kernel Developer