From patchwork Wed Nov 23 18:32:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 25143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2958055wrr; Wed, 23 Nov 2022 10:34:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6LNqJe+H8HSLKsEaUMH3eflMYUCXSjblQli78JzIl/wEF5/0sQuS+dG1siG4a2NEmOqzU+ X-Received: by 2002:a17:903:486:b0:186:95ca:1e4c with SMTP id jj6-20020a170903048600b0018695ca1e4cmr10519372plb.13.1669228482060; Wed, 23 Nov 2022 10:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669228482; cv=none; d=google.com; s=arc-20160816; b=hOQJgbsE3SarIv3oxKHH+rSzl2w8b5bbNDASyGRfE+nChUQjkarpiUcv2mY9dtnvxm NMpkvYRvakdTR/cT6W/6wT03Pxxba+bOYQYxAetcxd2vTHO7dpQurdgXJkidsvyC7hc6 vpDeQTb+YBhULX4mNjhdFMIhdE9V7UtUXi5xB6M3eZ7AEv2A5+HY4eSiRebn3aIotbWw u9b6T9abaC86u8eMTfQ60goq37B+pfjp/hRthjlpBBYv/Sm7LwLSuceMkRqFSG59rfea Z0Cg8z46gKWYJxttH+XDNWue7cm6qPELQ0sVlxWEX59nYNyohM3SyiyEbk5bm1N4lmTl xi5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=HFS/TFV5Fr1gZcBh1KwYegY7XKpVS5/yp/VV3VDAkFs=; b=B/o4ojsn/ULLkAevhSE/AJTAqR+0OqLy1FGKyrLnMB4DHRzcZGDUpAR9+Xw7ONzi2s WizKItkvyO/ajPoQDa5LOQtPwRlXrlwXxDsRiATNeaMD/MPkuMOOEeqaEFFzSs1MnSyl QPqT+dYJEUvO2vsAsQLADp7yNW2QqEeAh7MKEENlsfV3peLImxsEkMzx/C0pQrEve5Vq i/3j1BmOOuaSQFhYCalF8SkGfW4E2e82HNgupULb3FiEZ0QWsJvcQS69bHtybNpMr3mL guP8yFGEQAXlqPxsGICu2lwz389HQu9zcWsWLsz3Q0AwBOm7pElgSj0kYEE7Y9wbHYVq 89QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="SsN5BCR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a636c08000000b0046f0b3f7dbesi17442023pgc.408.2022.11.23.10.34.29; Wed, 23 Nov 2022 10:34:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b="SsN5BCR/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239729AbiKWSdx (ORCPT + 99 others); Wed, 23 Nov 2022 13:33:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239732AbiKWSdL (ORCPT ); Wed, 23 Nov 2022 13:33:11 -0500 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD294D7; Wed, 23 Nov 2022 10:32:54 -0800 (PST) Received: from W11-BEAU-MD.localdomain (unknown [76.135.50.127]) by linux.microsoft.com (Postfix) with ESMTPSA id D537420B83C2; Wed, 23 Nov 2022 10:32:53 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D537420B83C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1669228373; bh=HFS/TFV5Fr1gZcBh1KwYegY7XKpVS5/yp/VV3VDAkFs=; h=From:To:Cc:Subject:Date:From; b=SsN5BCR/KIuwbC887JFaiXfq0yDwvoxWluS1/Rn/4ffQbgyz9ZbLG6A8DuvqLD3zh 6gb5y2g0m6X065EBT1xP/3Dir320ma4niyB7jw+FnVmWJUE26yNYe3F0VIBVMR8bk2 iC6nfm/f0ZA8CGWPFNUobQxzIkbtRvCZ2ts+Yhls= From: Beau Belgrave To: rostedt@goodmis.org, mhiramat@kernel.org Cc: linux-trace-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] tracing/user_events: Fix call print_fmt leak Date: Wed, 23 Nov 2022 10:32:48 -0800 Message-Id: <20221123183248.554-1-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750312924472633543?= X-GMAIL-MSGID: =?utf-8?q?1750312924472633543?= If user_event_trace_register() fails within user_event_parse() the call's print_fmt member is not freed. Add kfree call to fix this. Fixes: aa3b2b4c6692 ("user_events: Add print_fmt generation support for basic types") Signed-off-by: Beau Belgrave Acked-by: Masami Hiramatsu (Google) --- kernel/trace/trace_events_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c index ae78c2d53c8a..b46844736015 100644 --- a/kernel/trace/trace_events_user.c +++ b/kernel/trace/trace_events_user.c @@ -1357,6 +1357,7 @@ static int user_event_parse(struct user_event_group *group, char *name, put_user: user_event_destroy_fields(user); user_event_destroy_validators(user); + kfree(user->call.print_fmt); kfree(user); return ret; }