Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2680000imj; Mon, 11 Feb 2019 06:56:52 -0800 (PST) X-Google-Smtp-Source: AHgI3IYs6+Ez+9H7krZJLDvu9UqcT5SPEC9vnjh0YzWQ/sq3s2IYPpwU0DqAY0NEsG5WPN5RNbR5 X-Received: by 2002:a63:1063:: with SMTP id 35mr33990201pgq.133.1549897012246; Mon, 11 Feb 2019 06:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897012; cv=none; d=google.com; s=arc-20160816; b=l+AACPQMiThObSqpdhpU1IjrrirrW0G2hUVQ+sZ+pt5oGcUjZHFr7bTZ93zplccvsN 7fx1uRGAe1ReOKNZ4RsSFeQ9FBpDTZuT6nlof8zhzTxZunneVPM3XE+Cm99uSEY/iwB+ gapSHFCy3usLyC94Za/bYNGLt9msMFU2oFW07hKqQaLM/2svqXw7dS1dEZpQMLVHK9Wm uaTmEqyZLllCzkPwHigCSpQOhyuKzZ4IzBBXhNG7ZnRnc8a1kihEDLVU6JvYYa5xgjfX XDobdfuvx+ttrk9CxGYMdLYLvbsF49lDUrkU9QhJnnZrFaQvYMVBfFY9Ftf+b54/R0FS tUNQ== 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=VltpuPnamndtUt9uplxoB2S8PHyGQMoLFy9MzzsXRs4=; b=mLsr20L7wSlRR0Ro2DAgbQXmIfqVN5yeMj68iSdyjN7c4WBWXwMUwLsJtPqc7HW9VK xcYnAPNToCQdiS3ugu88kd4H4iU2iWhegy9RHVCX73jj2eSBljD2yBXK9x79CXTEVPk/ xu/VuySVdfw6ZXl1u2VVcq0JWEszkc7qbmbifbhsST4sinOM/YxxwedWs9hqu8emcLWd 3yASuQ0cZ3cCB2x5c/eGIGCFLEKArj7PgY7BKyknAB7oj0aPVDCNBxAPAMLTTYRqu9U7 LKCLCBBGCGcSmsqwo8cGUIXUmPvyqHUDSRPNPWr0Z1NJlq1QSfZn3oBEeMlnYA55Rplf 2ctg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qGGEdjVG; 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 1si382284plk.296.2019.02.11.06.56.35; Mon, 11 Feb 2019 06:56:52 -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=qGGEdjVG; 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 S2389011AbfBKOzi (ORCPT + 99 others); Mon, 11 Feb 2019 09:55:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:42646 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388998AbfBKOzg (ORCPT ); Mon, 11 Feb 2019 09:55:36 -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 DF01D2229E; Mon, 11 Feb 2019 14:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896935; bh=ETFiV5DaBSdzle91qOZKMG018vNCbfgcJez5Ws9ae1Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qGGEdjVGgwvLKqYRAw+9E18fwUeXwp0ckr/gU67h4yWcTrgmBOMSoReix2VQd9RNQ 7wabZj373yTZRx8yTio37liBho6hImt+yWNDKGHXsIPCQagsHIRm0u8imqDffg6LeJ mSYQ8//OQSRaLssYyhVz9Cc5q4ySVsm//6P00EJ4= 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.14 019/205] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl Date: Mon, 11 Feb 2019 15:16:57 +0100 Message-Id: <20190211141828.403909563@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 a421d6c551b6..ecb41eacd74b 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