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=unavailable 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 0EA53C433FF for ; Fri, 2 Aug 2019 09:37:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6A4C2087C for ; Fri, 2 Aug 2019 09:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738629; bh=oQL3dscuh6qX7Vre1LFBvA27cPXfWucIPTTDPm7CFkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dTCnVcOlYGdCNBPZH6CrkBc7UcMYbKM+GEd9997VqiI17h29xUNe9Io0StVDRWxIn 5iH71KnixSWFDNGtmQujgA0g5GdPu7/Dq4CIyM6/5+uJ6/od+B8AwZ51CAg8yt5YOg cuFC7Yri3lIlAjZJvBkVJQO9tnXfYA2OG/T6BJ+w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404831AbfHBJgP (ORCPT ); Fri, 2 Aug 2019 05:36:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:37002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404829AbfHBJgN (ORCPT ); Fri, 2 Aug 2019 05:36:13 -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 90AB5217D7; Fri, 2 Aug 2019 09:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738573; bh=oQL3dscuh6qX7Vre1LFBvA27cPXfWucIPTTDPm7CFkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBMnueWysJiANqS8qubs/yazsTX2i99C2yhcIvv47F6odu96V+/NI18NpfSV93g5w kxtHDHMfT3VblDjLnnscK9EF0/Tm6LU+yBuVgmI2OMzLW1KLg1DkQ2qQOOorEVJfnu 2uNeLYM86stZFCzJmEKF55zSyzKh5M3Ay8jbGYOc= 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.4 157/158] drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl Date: Fri, 2 Aug 2019 11:29:38 +0200 Message-Id: <20190802092233.715402130@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092203.671944552@linuxfoundation.org> References: <20190802092203.671944552@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;