Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp454275ybl; Tue, 28 Jan 2020 06:14:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxrxOShbx37AuisPlHl1Nke1Y5YbxU1fyV6UKZbdcmLDDtysbHCAKbXEeDQY8lmDqAuoGhC X-Received: by 2002:aca:dc04:: with SMTP id t4mr2807595oig.51.1580220861620; Tue, 28 Jan 2020 06:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580220861; cv=none; d=google.com; s=arc-20160816; b=aQwu0ywKyfP9yF91/5f8E179aP9GSQgbRSjUjJujW411/R8C1VLeBHW9Dk1sp6OzgM DQGVls1LH9KDnvXX9Npq0qB5N/+IDcfJ0Zn/G5QK19Z9S/AnsOHh+0j1GWRQ+Mo/eL7M E9U24kAuwu8+YXisQQh4uPmVxDYHxw+0NPRB+E71A3+80rE3gQldKks8q1+Qbq60C3X4 yc+t9bDny6RnpS9zXyr+5rSKJpilBs8rrYRpJofmbG2fvlRz9gPX2otDPOnsJqzkd26U 1Z5DwYlg0mZ3RgZeNtm4ZyTO4ox9GpfAkT3lzneZ12sd3e+tpB4PcbzB6DXGgdTdPKor uXpg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RxblQTj9tyglmyviXU1OXOkWuoGqGnp0U4LUdp3dcgo=; b=KptHaTWhMro5bn0x2Bg8FyhXDRj9kWWV1zgABo2ReIltqlh2USaOWvu6A8AdJVv5Gt OAhEiv9FB8N8+rJs5D4iJp8lW3D/j4Tqtot+wnIIrgZqHRm+ZnxziNtQI6xJ9BWOVApB yq1945VfkrFYXXsb5nh+AEl0GOF+hIMJHyPDx8oSyJDn3GbXNVdkOeGk7A/0rdXmHjaO M4qS5SLQeuU/+m+jvPwEkdIajHu/cwZPtyIHwomJZpfwHSw+rvgW3aktcqNW5T4mtP0e D8o/eIgo/WmzLs7pG1UewN9gc06jyBUroyv4siSFDua1SeNapGxhxIhZ2v6SZ10eTn3y 56VQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zL2TP4ug; 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 y12si5197079oti.162.2020.01.28.06.14.09; Tue, 28 Jan 2020 06:14:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zL2TP4ug; 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 S1729658AbgA1ONR (ORCPT + 99 others); Tue, 28 Jan 2020 09:13:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:34732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729113AbgA1ONJ (ORCPT ); Tue, 28 Jan 2020 09:13:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 4292A2468A; Tue, 28 Jan 2020 14:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220788; bh=cXhWVoe8l7SesCfbvpKHyaadgu/BrM44Hjki1zDwezM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zL2TP4ug485Eueab8DY7W+BV89oLPJu+dL/ZTBe9AJ7SchYvyey/5PLE6eXbZKXmP Mocji6R4iHTkig83YSTdsVSuw0Etmc5POs/wfGCj8Lg5xLR39dFZIY2wuBKZ3kpBlI jGBERp3/TciZM076lSSpL64ST5WDVMdepEUkA2pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.4 146/183] net: stmmac: fix length of PTP clocks name string Date: Tue, 28 Jan 2020 15:06:05 +0100 Message-Id: <20200128135844.326536543@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135829.486060649@linuxfoundation.org> References: <20200128135829.486060649@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antonio Borneo [ Upstream commit 5da202c88f8c355ad79bc2e8eb582e6d433060e7 ] The field "name" in struct ptp_clock_info has a fixed size of 16 chars and is used as zero terminated string by clock_name_show() in drivers/ptp/ptp_sysfs.c The current initialization value requires 17 chars to fit also the null termination, and this causes overflow to the next bytes in the struct when the string is read as null terminated: hexdump -C /sys/class/ptp/ptp0/clock_name 00000000 73 74 6d 6d 61 63 5f 70 74 70 5f 63 6c 6f 63 6b |stmmac_ptp_clock| 00000010 a0 ac b9 03 0a |.....| where the extra 4 bytes (excluding the newline) after the string represent the integer 0x03b9aca0 = 62500000 assigned to the field "max_adj" that follows "name" in the same struct. There is no strict requirement for the "name" content and in the comment in ptp_clock_kernel.h it's reported it should just be 'A short "friendly name" to identify the clock'. Replace it with "stmmac ptp". Signed-off-by: Antonio Borneo Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver") Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 170a18b61281d..147c9f8cee7f7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -157,7 +157,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, /* structure describing a PTP hardware clock */ static struct ptp_clock_info stmmac_ptp_clock_ops = { .owner = THIS_MODULE, - .name = "stmmac_ptp_clock", + .name = "stmmac ptp", .max_adj = 62500000, .n_alarm = 0, .n_ext_ts = 0, -- 2.20.1