Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp414572pxu; Fri, 11 Dec 2020 05:32:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoj+3dK4mHff+S6gqVVKAfmPvqe/nnhe9cqBoURmAVwgxrs9m/bamwuZvDvOt2NMx1a/Nq X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr11569380edu.360.1607693545273; Fri, 11 Dec 2020 05:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607693545; cv=none; d=google.com; s=arc-20160816; b=S5BaTJgrUe9YYpr8NSbSl5ZOtil8pg/NVOk3E6sf+OWgP2FGaxmHDhWBiWhWey4w58 NdvQfS5WnVPcV4D62h/p+JZ6XdvLITqX4zdEg3eKQGUp95VUsqxBmCmZEzYj8BBxJU1O Hd5n5yChS0pHBq2m/tNbbbI/rY3j605u+yDMcFsv7+DRCZ2cO47FpvMtqr7h2Sn7qWR9 Iv+nGakZSOw2Ow+cawegekUgjRk+J/Hs/tS6STuHEBtH1ThOcLozH0074Wl53ua1h4+x Fa1Oi4if470An6iSJybEnr+LDSepB20L8n8xjeTDgJ8n60g+L0rtWHHrB7xmIf0OtOsm d1pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=kgwSr4PAiMbSkQS5fVTvEXAojEXOpIS4aLZExiziWKA=; b=qwaKxRonUEK2XqHgSLFkLjMI9RCY1Qz8BsjSvOkdsrdfzF+ipeCMKA6l4fipcPjpmz +uNHJyPDuDLNa0dHhc1ZVcbEg4VCxsAV4eHfdI+mIv65AV/GiVjemryvJ8i9AszU+SeC 6LH04MLCJXtnfGuZLcllbzHcXTzczOHqVJ72yNqNaq8zUNeJYyZGOmse2Q8EVK6v3Ubt Ed2h54zP2xVqnhsUp1kquW0VSPa7v2z02MES8B4eaEl9E0tdIztRlWdRP1UyUtxhAcAK AYMXQC3uZSapSdQFcvSwbmFcv3rQZwV/RejT6Zwo+1G9jlxQCuIYiGdZ+IwXU6MXWOzi +qpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L77Yt7sL; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si4067918ejg.492.2020.12.11.05.31.48; Fri, 11 Dec 2020 05:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=L77Yt7sL; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403826AbgLKKPF (ORCPT + 99 others); Fri, 11 Dec 2020 05:15:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:47542 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732294AbgLKKOi (ORCPT ); Fri, 11 Dec 2020 05:14:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607681592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=kgwSr4PAiMbSkQS5fVTvEXAojEXOpIS4aLZExiziWKA=; b=L77Yt7sLLmExJ14UAv8yN/H3yUCt8CBd1N5LIRn3/0WRsyeRhXRjQ500sxgiSMi8EBWT3n pgZlzGrzLCSdl+PwEC85klAj9Q3OpPklI3Zi+3jANOSSZyrWhesMwEJz4G7pTEUrCwW+9R UKFqtUBI0eCCsDPJgzGgAcFQRCzz7jI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-ggoy94WhNdSPcNuRCx6s7A-1; Fri, 11 Dec 2020 05:13:11 -0500 X-MC-Unique: ggoy94WhNdSPcNuRCx6s7A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81C998049C9; Fri, 11 Dec 2020 10:13:09 +0000 (UTC) Received: from dwysocha.rdu.csb (ovpn-119-199.rdu2.redhat.com [10.10.119.199]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B63FD10013C0; Fri, 11 Dec 2020 10:13:08 +0000 (UTC) From: Dave Wysochanski To: Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFS4: Fix use-after-free in trace_event_raw_event_nfs4_set_lock Date: Fri, 11 Dec 2020 05:12:51 -0500 Message-Id: <1607681571-10202-1-git-send-email-dwysocha@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org It is only safe to call the tracepoint before rpc_put_task() because 'data' is freed inside nfs4_lock_release (rpc_release). Fixes: 48c9579a1afe ("Adding stateid information to tracepoints") Signed-off-by: Dave Wysochanski --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d23edbc36803..6bf0457032c7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7110,9 +7110,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f data->arg.new_lock_owner, ret); } else data->cancelled = true; + trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret); rpc_put_task(task); dprintk("%s: done, ret = %d!\n", __func__, ret); - trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret); return ret; } -- 1.8.3.1