Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2648171imj; Mon, 11 Feb 2019 06:26:38 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ7wKooAWJC6N4ux2OgGGCyIe3MWvNZRhg1lFyxaewXbEDCjHVNiCEQoq1/whOu2FAaDr2w X-Received: by 2002:a17:902:704c:: with SMTP id h12mr38645454plt.30.1549895197990; Mon, 11 Feb 2019 06:26:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895197; cv=none; d=google.com; s=arc-20160816; b=JLeUnDFlfUmP0M0S2EnAtqfq7XQNbkio0OPnjDc4Wts1j9QZ7iQdDZ9EXpZTLi2zeN 5n1rUMMhgjv1BUDXKoscud/K9ajw0iPi0I5x12lXS6dWnzWRwzsoH07uwZuPrQDKPTFX QdvV1Bh42ivUQgQUTbPXTtaMmnEdxENcmtsQLTPOG+EOR5hdDMMW2WEJ6rkIhuwEC0MN Mtif4vC0Ly6bA+SmRE8IaDJp1ZlyBUYuOWOHuNZJv2jLsT6PEGu0+D1n2hrZbCYXTZnO sNTAQ8xfjyai/pe0pPlyrIp1QH0UempxduYcBgPXQvdSkTd/hlN+8yFtei7EEfQtnfOA x0jQ== 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=h138NMRKH86dqb9ZoUibyLTimxIeL4j8KB7S9Whv6/w=; b=RPwfEFa/8AcqazY/stX+xeQKt8+puI8PFp6tyvJUvXvVBZeAY+CORxxrPgE+6b28RW 7++Iyvns7EwCJ5NWmPZc1QdaugGdc4TWVYdd1MxXLV6Mwhius9s+g85F+35bNESf+ROs /o2JtF9GmSRvpuCDzd4MAkKf9mEK25TSUxf+KLgCv2X4J/eAfPKIlGq0AAbo9f2O76Wk fmGUDZYTfgRGtCag1g3swP0KjUK3Zpt92UHfdw0SrDSGE3uOfYcFOyEge8/cxVtJFagC UQnbd8c47TaytXDuCZILVMI6/ledNYOjbIpLbeuFm9C1v54PI2SyBEU3hfDMWiy1zJnk RNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oyMUO+Ko; 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 q4si10739728pfq.56.2019.02.11.06.26.21; Mon, 11 Feb 2019 06:26:37 -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=oyMUO+Ko; 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 S1728663AbfBKOWE (ORCPT + 99 others); Mon, 11 Feb 2019 09:22:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:54942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728652AbfBKOWD (ORCPT ); Mon, 11 Feb 2019 09:22:03 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 963BF20838; Mon, 11 Feb 2019 14:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894923; bh=vUYlB/e2QYkBXMJNmPmOB6B9nrFgjZj8OvAhldyjlJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oyMUO+KoPtNVfj/Z0Nl9r/Zr1Bvo0v0uebvVmTKTQieIiFQ1ey07qb/Lxqg2UiB7V qDMgXOnW6Dg/6iZuLnRliWAocQXPbJEuB5RarExqKRvNc+BxlNB+Em+LVGvyLl7G/W BSEAqDAg398955e2gIm/Q3krjMuFMQAo2OPxmsq4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Cochran , Jacob Keller , Miroslav Lichvar , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 032/352] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl Date: Mon, 11 Feb 2019 15:14:19 +0100 Message-Id: <20190211141848.388810894@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 83d0bdc7390b890905634186baaa294475cd6a06 ] If a gettime64 call fails, return the error and avoid copying data back to user. Cc: Richard Cochran Cc: Jacob Keller Signed-off-by: Miroslav Lichvar Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/ptp/ptp_chardev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 2012551d93e0..796eeffdf93b 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) pct->sec = ts.tv_sec; pct->nsec = ts.tv_nsec; pct++; - ptp->info->gettime64(ptp->info, &ts); + err = ptp->info->gettime64(ptp->info, &ts); + if (err) + goto out; pct->sec = ts.tv_sec; pct->nsec = ts.tv_nsec; pct++; @@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) break; } +out: kfree(sysoff); return err; } -- 2.19.1