Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp495562imj; Sat, 16 Feb 2019 05:07:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ5VA5J3ihCarI55HBF0YRXk2VhKx2QTazPOmTA7IEXgsTDmdSuNjsD6kyRN2KmqGdEbRGz X-Received: by 2002:a17:902:a588:: with SMTP id az8mr15367786plb.77.1550322436431; Sat, 16 Feb 2019 05:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550322436; cv=none; d=google.com; s=arc-20160816; b=HqKXVkQod+uBPWR0BVUkZHFo9Qo9x29GCgqk/i2tBgsjtD0pf9oIZw1MdDjVS7F8N4 ipFDaUc3GtN66YwjEhDB1na5KHEoghx19rxoEaat8r2qHypHi1UOc+1MB8694dv32qTu 9LQ128GeoGExxga9xU8qmb+ixOCCaAJcRBqioeiEdWQ3Y/VzGkaBs1d1PMiSugc9GYf6 TAg3FqtQ/do95NIdAhTH6NfdgyNWnP/GjzPtwy4vilxXCuyMi99nrBWWzQKdEeHFrrzq Gb5oWvzzxJ3fXBMNAD0uMXhfnUXyWugXnr/bb3L6/TK5X8skK3f1q9tmNM6Mchme7XR3 vqjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=Ij/+Ao10g9WYxM2AmHxgE7R+CHjmhmahXnpR3v2eLtY=; b=Gpw9Mr37T12mR4rwovDWn6bVmdt/D+gINHJuhkBcj/j+e+mYAvpGtyOprJ5FIJK9oY NPGPhwfPj20a2PlT+Ga7G44Ozls5/OdLLLCtJdomgB+//wwWfYA7s9hAbR5fHHSQC+fH qSDB6/Jg/vC/biBcIEtcECU5ImgrC8nw078BFmJjlTLeFCf76iIwxko4AlL3im38Gk5X pV/+TEsI9tiyF8+bN72ii/qVb3H9bru8wXsaH3vzVSox1C2IUkbU/wHJpQ83CHSxbOnO oJFIPDxsoLWIKelbij1GZLqwh52jsBPARFykOGRoL7/6ZvWne7hnuuFxCbPsJwxjgU+A fY7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si8527956plv.138.2019.02.16.05.06.59; Sat, 16 Feb 2019 05:07:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729222AbfBPLTM (ORCPT + 99 others); Sat, 16 Feb 2019 06:19:12 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:3222 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725294AbfBPLTL (ORCPT ); Sat, 16 Feb 2019 06:19:11 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8040581B00B149F3FA97; Sat, 16 Feb 2019 19:19:09 +0800 (CST) Received: from [127.0.0.1] (10.177.244.145) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Sat, 16 Feb 2019 19:19:03 +0800 Subject: Re: [PATCH] tracing: fix incorrect tracer freeing when opening tracing pipe To: Steven Rostedt References: <1550060946-45984-1-git-send-email-yi.zhang@huawei.com> <20190213083635.36f4762e@gandalf.local.home> CC: , , From: "zhangyi (F)" Message-ID: Date: Sat, 16 Feb 2019 19:19:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20190213083635.36f4762e@gandalf.local.home> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.244.145] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/2/13 21:36, Steven Rostedt Wrote: > On Wed, 13 Feb 2019 20:29:06 +0800 > "zhangyi (F)" wrote: > >> Commit d716ff71dd12 ("tracing: Remove taking of trace_types_lock in >> pipe files") use the current tracer instead of the copy in >> tracing_open_pipe(), but it forget to remove the freeing sentence in >> the error path. >> >> Fixes: d716ff71dd12 ("tracing: Remove taking of trace_types_lock in pipe files") > > Thanks. > > As this is harmless (frees to NULL is ok, and iter is allocated with > kzalloc()), I'm going to just add this for the next merge window. > This patch patch want to remove kfree(iter->trace) instead of kfree(iter), which is set by tr->current_trace and probably not allocated dynamically. So if we kfree such tracer in the error path, it will lead to BUG_ON. Thanks, Yi. > >> Signed-off-by: zhangyi (F) >> --- >> kernel/trace/trace.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c >> index c521b73..b583ff7 100644 >> --- a/kernel/trace/trace.c >> +++ b/kernel/trace/trace.c >> @@ -5624,7 +5624,6 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) >> return ret; >> >> fail: >> - kfree(iter->trace); >> kfree(iter); >> __trace_array_put(tr); >> mutex_unlock(&trace_types_lock); > > > . >