From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98E74C32750 for ; Fri, 2 Aug 2019 09:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73674217D4 for ; Fri, 2 Aug 2019 09:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739593; bh=oQL3dscuh6qX7Vre1LFBvA27cPXfWucIPTTDPm7CFkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P0KxJC9j7WVxASmZMkdMOroUokmmLa/+exE1zc6GPLacSCUq7SHCY7R74kjl1TiqD cs0LfKP13T7RGdNNPWbKlBTCifoDUsY98uylKsxHns1dCAaJMr45/YgU+SaZxVrCAH gAGag0LZ6hbRGYW7xNmr9o9Vv/evf6u53QF5rTsE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390762AbfHBJxM (ORCPT ); Fri, 2 Aug 2019 05:53:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:59136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406161AbfHBJxL (ORCPT ); Fri, 2 Aug 2019 05:53:11 -0400 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 1484F20665; Fri, 2 Aug 2019 09:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739590; bh=oQL3dscuh6qX7Vre1LFBvA27cPXfWucIPTTDPm7CFkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIrF60FSu0yM17DWQnhHXV5Cbb60ys8OdpxEN5xJRj52HDWEtDFdh8xvW99+4S+m2 ORZYq5Epn9Quqn2r7d3PbRblUqLlbnK6hnUb2ugnvlmOIOzyS4ATxQD19PTjYkDAmm Jm9fPaC10WWQi9B4MjV7d17E5fJoTM3dZZhtW6b0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miroslav Lichvar , Thomas Gleixner , Rodolfo Giometti , Greg KH , Dan Carpenter , Andrew Morton , Linus Torvalds Subject: [PATCH 4.9 222/223] drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl Date: Fri, 2 Aug 2019 11:37:27 +0200 Message-Id: <20190802092250.950010784@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miroslav Lichvar commit 5515e9a6273b8c02034466bcbd717ac9f53dab99 upstream. The PPS assert/clear offset corrections are set by the PPS_SETPARAMS ioctl in the pps_ktime structs, which also contain flags. The flags are not initialized by applications (using the timepps.h header) and they are not used by the kernel for anything except returning them back in the PPS_GETPARAMS ioctl. Set the flags to zero to make it clear they are unused and avoid leaking uninitialized data of the PPS_SETPARAMS caller to other applications that have a read access to the PPS device. Link: http://lkml.kernel.org/r/20190702092251.24303-1-mlichvar@redhat.com Signed-off-by: Miroslav Lichvar Reviewed-by: Thomas Gleixner Acked-by: Rodolfo Giometti Cc: Greg KH Cc: Dan Carpenter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/pps/pps.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c @@ -129,6 +129,14 @@ static long pps_cdev_ioctl(struct file * pps->params.mode |= PPS_CANWAIT; pps->params.api_version = PPS_API_VERS; + /* + * Clear unused fields of pps_kparams to avoid leaking + * uninitialized data of the PPS_SETPARAMS caller via + * PPS_GETPARAMS + */ + pps->params.assert_off_tu.flags = 0; + pps->params.clear_off_tu.flags = 0; + spin_unlock_irq(&pps->lock); break;