Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2383260lqp; Sun, 24 Mar 2024 17:01:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV29r8aBSdwr1GHXTRt9Zv+f4ac69KpWPiiPVy0Ww0hCGR8TQTcelbueuIy9Ei/qhFT9OKUOVc294ctOgHHqhpe9fGQG8ltbiY0jF7PJA== X-Google-Smtp-Source: AGHT+IHG3aA4QK/4pTLGCRsWJxE/EEmfWk/3zT88faEjZX0U41s/hVGdNsycXzN4UbJXwtXrj9V2 X-Received: by 2002:a05:6a00:990:b0:6e7:f4:3661 with SMTP id u16-20020a056a00099000b006e700f43661mr7556038pfg.13.1711324878584; Sun, 24 Mar 2024 17:01:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324878; cv=pass; d=google.com; s=arc-20160816; b=RY55RjpW55g2rVmSb1Alnu4/MqP0jOqZkkQPDo8SGFBe/HMgeMK+CCoPvkQXwW51RO XGWCqcJT9YAcIvgo9eRgDlbGBg/zU2n1j9W72JY+OCiZGbuOO2sSFAvf8LXsFWvAhFNV OK1sT96qyKc6crhhjU2mb6YLEMvsBvRYSmGZMjm/r27r98s+XyKcOPm/Qc22ibXh73P7 ItxyBI8pv0YTjZa/4xpBNgwT+rMiR0yod/QsrqgViKeuK6lOkoYOOFQjXK1Fn7WUDr2D bNJ9NlU+3ICQLVKm+W0WeJrkYp9jzz5AEGNfEYfaVcKDB1zreJ2LbvAUSD++ah0RxvaN M4gA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JNKA/ny6YNfuwZDR2SwjxcislYaeUxygs2sdui+mwkE=; fh=j3VVVxKI7R58MooQaNg1l9nm3oQYgj2FRPC0FAu9kqc=; b=ZEQ4gADgaeSRu3StO+2/3hUsvQgwNECGQaMvT367gQ/3Kw/XIEpbTQXygcMJSb7ZHs Q9KRSVCykzaHtTrvo73xOqRfUG9hHg1IDcMrapUkVGP6huVTnQKYSl0EzoeTYJWDRx6B 4pVdDGoqrDIybkTuEzgKOlAH9kxa28CWUJfT9jXnfLbRouvcydqf6NPmZ9MzZihYjDu3 UheynHEPzEJe0M0Yj6qEi/IbPQ9dmMVLoWSH8/gGbM2ARrM1ail5dFOgvwP3JBwp9dMh 1PAnjS1BMkQxSC0rhpR3eyKZKgDO7ahETs+ZG4wzZonyix7A1tN2RaLV3WInaePCQKPn 0BPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CcNnduTi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a8-20020a056a001d0800b006eaaec37ce0si293824pfx.76.2024.03.24.17.01.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CcNnduTi; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113266-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113266-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2CAA82842F4 for ; Sun, 24 Mar 2024 23:57:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4C9C136E08; Sun, 24 Mar 2024 22:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CcNnduTi" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C5E21189A50; Sun, 24 Mar 2024 22:41:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320065; cv=none; b=CDn1rk2YbC0pLyXGw2Zi14PsQyIGPDj9rInMLZBpol26d2unlHGXWIyZJfdf4jsvbaBrSpblDbubL9l5GHlDBmrSft1ld5P+aRKnl6145y4tUhOtkpAyRhgSSqCOVLfmwX6Um/BqS0OOOWAhpAWpbJP53CWZMlgZnTKGbWnn+Jo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320065; c=relaxed/simple; bh=FT+rCKaxioFNKhY6F29SWX7MZZFV7Geg4xGwQ0Qs/Fw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JzMZ9iYUtXvLfbgku5OsJxBuxuEAGlkEZmBOWzxtIktowRKwbemKPwifLRe2xq6qdW/2qVfr521dgw1HO8Tw1iAYdklG4v7X51vhK31vlb9RPOgxPD3+VdvJ8BD1aHGIW6Mwdz58bixkiQTsibHWi3PikbfeLjE0aW8fUdK0XsA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CcNnduTi; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 045EDC43399; Sun, 24 Mar 2024 22:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320065; bh=FT+rCKaxioFNKhY6F29SWX7MZZFV7Geg4xGwQ0Qs/Fw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcNnduTiJ4RP1lYD9xe9e+V14UilEwk1Ph4ZPsWJtMpi2OX9Xgn7EVfKc7d9JZt9+ bJyU8xFAnroLsy3SHxvaXAiCfzJq9Ludu5wWYYHA8OMHmrc9C9gtht5nYdkXNOnvqL 8HOYkJy9yo6PnxDbIhcgqrMMfyEB/WZCPxy53AnNRRAzWEfsDUrTDcrvH3MTpuhgjO Gs0J9k/TWAVCBsQdVY9hL1D1WlzNKp76MFhpAynjxeUM5Fq2vn5QjDX5Tq1Fe1YdKq HPCsCPXyK8IK/uF8awWGGj/GKocvZ9Mxg3u007i11mY2kgKsbsYdOgoivEGLzizGC5 3soV9yGf+I4ww== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Jihong , Namhyung Kim , Sasha Levin Subject: [PATCH 6.8 375/715] perf record: Fix possible incorrect free in record__switch_output() Date: Sun, 24 Mar 2024 18:29:14 -0400 Message-ID: <20240324223455.1342824-376-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Yang Jihong [ Upstream commit aff10a165201f6f60cff225083ce301ad3f5d8f1 ] perf_data__switch() may not assign a legal value to 'new_filename'. In this case, 'new_filename' uses the on-stack value, which may cause a incorrect free and unexpected result. Fixes: 03724b2e9c45 ("perf record: Allow to limit number of reported perf.data files") Signed-off-by: Yang Jihong Acked-by: Namhyung Kim Link: https://lore.kernel.org/r/20240119040304.3708522-2-yangjihong1@huawei.com Signed-off-by: Namhyung Kim Signed-off-by: Sasha Levin --- tools/perf/builtin-record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 86c9101251726..a8dfa533c1663 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1830,8 +1830,8 @@ static int record__switch_output(struct record *rec, bool at_exit) { struct perf_data *data = &rec->data; + char *new_filename = NULL; int fd, err; - char *new_filename; /* Same Size: "2015122520103046"*/ char timestamp[] = "InvalidTimestamp"; -- 2.43.0