From patchwork Wed Oct 19 03:35:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 13011315 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 17617C4332F for ; Wed, 19 Oct 2022 03:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbiJSDOG (ORCPT ); Tue, 18 Oct 2022 23:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbiJSDOC (ORCPT ); Tue, 18 Oct 2022 23:14:02 -0400 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56BB165A8; Tue, 18 Oct 2022 20:14:01 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4MsbNp6y3Tz6R520; Wed, 19 Oct 2022 11:11:38 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgDnLS53a09jvmtUAA--.10775S4; Wed, 19 Oct 2022 11:13:59 +0800 (CST) From: Ye Bin To: axboe@kernel.dk, rostedt@goodmis.org, mhiramat@kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, yebin@huaweicloud.com, Ye Bin Subject: [PATCH v3 0/3] fix possible memleak in '__blk_trace_remove' Date: Wed, 19 Oct 2022 11:35:59 +0800 Message-Id: <20221019033602.752383-1-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgDnLS53a09jvmt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: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: Ye Bin Diff v3 VS v2 1. Invert the check of 'blk_trace_{start,stop}' and return early from the function for the error case. Diff v2 VS v1: 1. Introduce 'blk_trace_{start,stop}' helper instead of 'blk_trace_switch_state'. 2. Move stop block trace from '__blk_trace_remove' to 'blk_trace_cleanup'. Ye Bin (3): blktrace: introduce 'blk_trace_{start,stop}' helper blktrace: fix possible memleak in '__blk_trace_remove' blktrace: remove unnessary stop block trace in 'blk_trace_shutdown' kernel/trace/blktrace.c | 82 ++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 43 deletions(-)