Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3427729ybt; Tue, 23 Jun 2020 01:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYRxHE5J40PjA1qdMK6GF2f2mS4X/yFsa2zVitkKUIwEpJYipdkrrgOjVOqJ0CNcKv0z3Z X-Received: by 2002:a05:6402:1ac4:: with SMTP id ba4mr13211404edb.60.1592902631048; Tue, 23 Jun 2020 01:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592902631; cv=none; d=google.com; s=arc-20160816; b=FUc4vD7fw8dmlNeTKGCILUp9uKJZ6YQkbpRbr76ngPOgKXlZ0cXVtnjhAkesuLEW5Z LKdIuMXnObdLMWjz3SjLXhh9Yc36V3Uu8j6E6FrLp/uNKHg6tPTKuawY45uolmxTN/Dj O1jF9txSKtsPx2MnKrX0g8/kme2XZBDZsu0GrYPHNX0hEahBCbxWpIdOWyEeiWnx4GV1 /TxRRbaVYx7J4GY/SOmyYdCnh4ZB7cWsSQh/ERWJ3uMSRG3Zna1SW8GMCa1rrrNW0mLw bAGpeNpyqOLl2BrGTBTRuU0PyfJTYuWkaZ6U4IYqCcRKZ09L4o/KJHgnRGfxdGoIev+P 8S2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:mime-version:message-id:date:subject :cc:from; bh=Li/8JePTDNGOQ/qyizD4tzRYx15KTHBcXN7+tS0IX94=; b=W9tauFRlrdJEsRkTJv//3qu4tY9xATFPOLzAoYpabCme7hbiK7apPJN7TxLbYFgXuc x29D6Y/vpz6TLrq9YoUGragLLliROcyNDasOJdzzgo5t3Ecl0rL8UBHgK+aRuBq0GyE4 OfpiLbiUD5MyQC4igaV+gmhnZPowQL0VOVeFB2MleTdKQDThljK5RjuMQU1XaPAHMmZX tnHgBunmtaISIEtpVBEmfimrA7EPsr/kTnsekp+E277Oan3+Xy980212KXX5RmiGLboH 3I5+Pg/BQ9uahMIlv7fPA+ada2HjiZNF9YtS770chCLm+JUb8iWZqfGWWXjGc1GgrhGe cSUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi17si4041168ejb.724.2020.06.23.01.56.48; Tue, 23 Jun 2020 01:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732046AbgFWIwi (ORCPT + 99 others); Tue, 23 Jun 2020 04:52:38 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:34788 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731840AbgFWIwg (ORCPT ); Tue, 23 Jun 2020 04:52:36 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DB9081C1A8914FFD59C3; Tue, 23 Jun 2020 16:52:33 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Tue, 23 Jun 2020 16:52:27 +0800 From: Wang ShaoBo CC: , , , , , Subject: [PATCH] tracing: Fix tracing buffer length in tracing_mark_write Date: Tue, 23 Jun 2020 16:52:18 +0800 Message-ID: <20200623085218.26426-1-bobo.shaobowang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __copy_from_user_inatomic() return the byte length that copied failed, tracing buffer should left this bytes. Fixes: 656c7f0d2d2b ("tracing: Replace kmap with copy_from_user() in trace_marker writing") Signed-off-by: Wang ShaoBo --- kernel/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 29615f15a820..ed5fe0f165e0 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6628,7 +6628,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, written = -EFAULT; } else written = cnt; - len = cnt; + cnt -= len; if (tr->trace_marker_file && !list_empty(&tr->trace_marker_file->triggers)) { /* do not add \n before testing triggers, but add \0 */ -- 2.17.1