Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1230537pxv; Fri, 25 Jun 2021 08:13:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtEF6Y1DUlL+CGTwfZqH3n/Dw7wo6Ks5PDL+/pYVNcFG+9Y4I5IfqUHsj4qkwCRp+NSE8R X-Received: by 2002:a92:3647:: with SMTP id d7mr7923327ilf.231.1624633993225; Fri, 25 Jun 2021 08:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624633993; cv=none; d=google.com; s=arc-20160816; b=I13jqjNL9CoWI3lA/6NRhMnrMEZKh/4+dx9Fn5PMGTUXV3SK/5KLZp3JVvPHv27t+6 uMAudxItuQ/C/ZjfSZ40z3epf4hngMFdBG7rnEbS6402x0Bmd4qNchpwzzOpWiu0R48a MrthVjWbwsfpM2qJ7fzJmaE7SQ3hVFB6V66X7uI+J3u+lqM89aTndprutRRzOVRIpBGv +gJ2z7/LtDsOYgRARhqRvkpD2Jiv495Z1dOLuOxFTm51j2yIlOQHBkYQGEi9L5t+ELfw sceqD6oOAdlOmzmCGrTCmC34iPBmdbKLkbTZ3/qisVw82punk3Bffiloli+vqOBMbtAA 1FLA== 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 :user-agent:message-id:date:cc:to:from:subject; bh=g++AEESgHf1ckq8ONDt7p/6XdTNFnjloF0X2ZQewy2A=; b=UdEy9WikeP1RsiXnhoJKgn/JoGcqi63kYEEVZKYLe/pzAyZWwf8RM5am2VD+PKuhPh rRybBGpwVifmIAxfGAutg4uJrRFW1WVzM1/r7MBKKsmXMRAPjYFBpOnwD5IRU46IZWSR C7lGiYdlqFAektWXf6ymkjubZeGWRYACrSOuSGB2H4HiKh+in7wesc3wWn21pLeU7yq+ ZnJDGAND0gCVFaLU7moaWylGBZy/C/mon/wJk+ZmNsLpeVn3E8IRE0oVZblFYyuIzWy4 As/sKWUtxKKgVmxkq9EGJfES37YOfHE0e2+opLe04nGd7LJ77R0Wh2dco2G01ZzHo48A Xymw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si1322406jas.38.2021.06.25.08.12.55; Fri, 25 Jun 2021 08:13:13 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229445AbhFYPPL (ORCPT + 99 others); Fri, 25 Jun 2021 11:15:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhFYPPL (ORCPT ); Fri, 25 Jun 2021 11:15:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D2F461428; Fri, 25 Jun 2021 15:12:50 +0000 (UTC) Subject: [PATCH] NFSD: Prevent a possible oops in the nfs_dirent() tracepoint From: Chuck Lever To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Date: Fri, 25 Jun 2021 11:12:49 -0400 Message-ID: <162463396907.1820.8112792283525036426.stgit@klimt.1015granger.net> User-Agent: StGit/1.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The double copy of the string is a mistake, plus __assign_str() uses strlen(), which is wrong to do on a string that isn't guaranteed to be NUL-terminated. Fixes: 6019ce0742ca ("NFSD: Add a tracepoint to record directory entry encoding") Signed-off-by: Chuck Lever --- fs/nfsd/trace.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h index 27a93ebd1d80..89dccced526a 100644 --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -408,7 +408,6 @@ TRACE_EVENT(nfsd_dirent, __entry->ino = ino; __entry->len = namlen; memcpy(__get_str(name), name, namlen); - __assign_str(name, name); ), TP_printk("fh_hash=0x%08x ino=%llu name=%.*s", __entry->fh_hash, __entry->ino,