Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2197649lqo; Sun, 19 May 2024 19:17:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUaVSDlfIUR7b2Xhz2M5RYxHnGEhPziD6y32I7wPxtZYv31HpiunGbXtOACdMC0sZjFse1O/syZSgZFk+HaDKSeqLwJsRw7Mn7w1Yn7nQ== X-Google-Smtp-Source: AGHT+IG/TXhWjph/cXs1f/0ZzCVldEdi4sma4O8pFeHZaoZnARr7qLEVYppmK5E4ZnI1c/zQAokM X-Received: by 2002:a05:6512:ac3:b0:523:e756:2838 with SMTP id 2adb3069b0e04-523eaf05db2mr6770154e87.39.1716171450825; Sun, 19 May 2024 19:17:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716171450; cv=pass; d=google.com; s=arc-20160816; b=EtHiTOfMTB2wfYBgGu7Vu3sdF06Wrk1Dt8xID4fIYggLc9Co3THnKZh1vsqJfKszGO T3CiI0foNrzhVfH+2Be2zeihF0EUs99YdOrikwsW+wzKTYpNjng5vH1rqkyL4kE0lLTk gcy4Im8e8/Eou42LZ/fDabomuxqulDsYU/LYZGu0P/CyLG5rHNnQx1K+p6GRMWkiBpZm IK2emTP8obvXX7kuyMp8yJj7MNFaAtz/HhxpLB/qCaVOKpjz2SckCf8AImFJGGnemwoV rfgnRid+yDUp1dO6/TcuZp2RrNIr5XDF/yJdLqa+rA9BlkgQZft4Ey8ItK3ELUOy0a1T XJqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:in-reply-to:message-id:date :subject:cc:to:from; bh=2zLNorzs6urxmaziJzRSJ2Kcnd7SgnvtTxlcSUSuYHk=; fh=H12ecGQEgcmt8PTfzYdfQ4v2Zqoy3BkeoMgaqz8YuYI=; b=wP9n9GbuZm1twc4/nOV3dHNpJAsG8s1tfVVMZUxGoWXAf883fCIlqgfvzosKu8NTne l/NFVCLmt7qIWAZnuBASEHfBBcUWOErEPIdxLgEkF/+vOzkW9T+l5sL3e4YbGPqJJokY fZNPBsxr06SklKkbIndVW9tS4SgMPDpf6kSQkTL1IRSFpE6XxthWQ0jyG2NJqKV9azUj hbQG8/cZsTv74e9mKS3hG4DuIV6CA/iDSBYTmh59SsgR0AZnuACrKlSPKtUXJjhcos+3 89MAN+W3lUiKW5MF9WBM3cJizTjUXIuqpEA4lWz0+7+6UrW3RgDjLWvfxBy09eKIOAS4 C41Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4793-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a3bc31d83si1136496966b.722.2024.05.19.19.17.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 19:17:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=nfschina.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4793-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3BDED1F21463 for ; Mon, 20 May 2024 02:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EBFCE57D; Mon, 20 May 2024 02:17:06 +0000 (UTC) X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail.nfschina.com (unknown [42.101.60.195]) by smtp.subspace.kernel.org (Postfix) with SMTP id E1C9A746E; Mon, 20 May 2024 02:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=42.101.60.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171426; cv=none; b=nE+VTPYTSuW+/kgOvFdCSC5ByzQoKSIBZsXlD4O4UoFqsEXoZrZyKHiPfMMoKHOBuq4ICAAug3D3V4RRuxFeWoR6iIUfI4FyvuJE5b1G7ApPL9tEE2C/tnHkDmH/ZP27kW9TxRvoMW2MvLBAkv/VX+KH9x/JthJOwKj/pcPtErU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716171426; c=relaxed/simple; bh=gvbWzLdHHAwB+c4e8VFjeusevcuOlKHRkliYwF5b56w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:MIME-Version; b=dBAwVFLAKvPvAuOWzWQ1jcmvJUA5cLJ4DvyQFX2cIF4C39qDwiyTFq8KPJCbSO8UeRUeTgDqPwHzbNQPa5o8vD39Sz8unXw02P55ILTPbIAXsp4ezvg7JviR48laU0aKNaB6ULZlsixAH2YSJQmZxcO+slBc785SD+DYHENjKMo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com; spf=pass smtp.mailfrom=nfschina.com; arc=none smtp.client-ip=42.101.60.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nfschina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nfschina.com Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPSA id 0246C6026E8DA; Mon, 20 May 2024 10:16:53 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: marcel@holtmann.org, luiz.dentz@gmail.com, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com Cc: Su Hui , kiran.k@intel.com, seema.sreemantha@intel.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] Bluetooth: btintel: fix use after free problem in btintel_ppag_callback() Date: Mon, 20 May 2024 10:16:27 +0800 Message-Id: <20240520021625.110430-2-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240520021625.110430-1-suhui@nfschina.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Clang static checker(scan-build) warning: drivers/bluetooth/btintel.c:1369:8: Use of memory after it is freed. 'p' is equal to 'buffer.pointer', using of 'p->type' after releasing 'buffer.pointer' causes this use after free problem. Change the order of releasing buffer.pointer to fix this problem. Fixes: c585a92b2f9c ("Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)") Signed-off-by: Su Hui --- drivers/bluetooth/btintel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index f1c101dc0c28..d94a8ccd1428 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -1364,9 +1364,9 @@ static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data ppag = (struct btintel_ppag *)data; if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { - kfree(buffer.pointer); bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", p->type, p->package.count); + kfree(buffer.pointer); ppag->status = AE_ERROR; return AE_ERROR; } -- 2.30.2