Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp940900imm; Wed, 25 Jul 2018 08:43:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeh8cZ0/HCRya/J9ynjybq5/SOdRHZFBA78k2tY/7GkMiyCrhm2WMG1AfwHuzWyXiisKaKe X-Received: by 2002:a63:e355:: with SMTP id o21-v6mr21465326pgj.251.1532533405479; Wed, 25 Jul 2018 08:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532533405; cv=none; d=google.com; s=arc-20160816; b=fjRnX3ARBjCTDYvhHcEK55alDMsCNZXhyk5/oP44uyk9etJtdj+Pa4hThgdjjCe2+U F5azDmBu5WaPLOM2RTS8XJ0VZn6kE7dF94B/fR7sze4RMzWF8xQ6TArUMYOSkaH+N1bi 2AUyKQlmyrePZNswYfl+NvddCXHzxuebc9GQOABaUS4IuPQ9ZqJHFhhtPI+l8CNij4yA l0jqvnk9yJNTZ8a/vq+TPGRhmvOhEH8wAHlxnp2BUD5miVi4EpN+YLgie4qQt/nMUPp1 cQ88uExIiGXgCddFiBtft7LADeFll7a82U0Lgcom9wCSintm8zZK+Tz5PttJjPGoJgmK PBHA== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=VNDauvlKTnKkHAJXb68+Ia/sNK6IxV2TWS+1l6HgWrM=; b=I27pzZ8it5FM2XZ2zrtNNnIRc0l5VT1lhNI8b8kWDwhKCC9U3AYrjNNrxjeQXDRqBq KFpfqdQbqtHnZCSg75InWrZ/7IH1Vl71SThgZboX0/5dQD48zAbVnxlVtnsA8pYBgCG3 Fkd/nFgF7ltOnShxRj0uq0XQewO2OnaUgVOEiFlU0fXV051R5/Ltl7TQFTybdEzKBAGL QBesslUcBW4jL5AnRSbn8grsQcImDLaJFT0mt4fMoJCwN8yP8/1lFs3dlXtu+epk+JW4 oF0phehoj7dOWGWk837fsaZ53gVzxTimdV/nUHvD23gu6g8rS9o3xML8Zcb4dQQ1+xuq fvYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RbCINOwA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si12774856plg.344.2018.07.25.08.43.09; Wed, 25 Jul 2018 08:43:25 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=RbCINOwA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbeGYQx3 (ORCPT + 99 others); Wed, 25 Jul 2018 12:53:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:40276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728559AbeGYQx2 (ORCPT ); Wed, 25 Jul 2018 12:53:28 -0400 Received: from devbox (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6094120843; Wed, 25 Jul 2018 15:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1532533276; bh=JiPSfkP6Jtly0n5W6fhKC3t99jzsPn/Gom8RJJgwWdU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RbCINOwAm9Wul6TXlB37iuWFF4LqrdAOEwyeXFSI9Uy9912xYCR7/XTrZj5l5JURW aHrBgIBDDqSfq48vLNFOH0WKUR+/zBqVkv7uMVOsR4dGHg6RcwpiZ/3nfmB3R1ZUlI Rjg9/9jwLR2T4HtS1qColjTwya9QvAEmNZU6/Zss= Date: Thu, 26 Jul 2018 00:41:13 +0900 From: Masami Hiramatsu To: Artem Savkov Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, Josh Poimboeuf Subject: Re: [PATCH v2] tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure Message-Id: <20180726004113.d578f6e6a2fa59adf1efb4ea@kernel.org> In-Reply-To: <20180725142038.4765-1-asavkov@redhat.com> References: <20180725142038.4765-1-asavkov@redhat.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 25 Jul 2018 16:20:38 +0200 Artem Savkov wrote: > If enable_trace_kprobe fails to enable the probe in enable_k(ret)probe > it returns an error, but does not unset the tp flags it set previously. > This results in a probe being considered enabled and failures like being > unable to remove the probe through kprobe_events file since probes_open() > expects every probe to be disabled. > Looks good to me. Acked-by: Masami Hiramatsu Thanks! > Signed-off-by: Artem Savkov > --- > kernel/trace/trace_kprobe.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c > index 21f718472942..27ace4513c43 100644 > --- a/kernel/trace/trace_kprobe.c > +++ b/kernel/trace/trace_kprobe.c > @@ -400,11 +400,10 @@ static struct trace_kprobe *find_trace_kprobe(const char *event, > static int > enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) > { > + struct event_file_link *link; > int ret = 0; > > if (file) { > - struct event_file_link *link; > - > link = kmalloc(sizeof(*link), GFP_KERNEL); > if (!link) { > ret = -ENOMEM; > @@ -424,6 +423,16 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) > else > ret = enable_kprobe(&tk->rp.kp); > } > + > + if (ret) { > + if (file) { > + list_del_rcu(&link->list); > + kfree(link); > + tk->tp.flags &= ~TP_FLAG_TRACE; > + } else { > + tk->tp.flags &= ~TP_FLAG_PROFILE; > + } > + } > out: > return ret; > } > -- > 2.13.6 > -- Masami Hiramatsu