Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5024693ybl; Tue, 14 Jan 2020 02:10:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwViCRF4dqsuEfp9fmMpDT5pjSBK7Qv0UcmqWBiuBAQ06cfVnniI4CqkZUK9FnA+smzsugo X-Received: by 2002:a9d:600e:: with SMTP id h14mr15612469otj.113.1578996628393; Tue, 14 Jan 2020 02:10:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578996628; cv=none; d=google.com; s=arc-20160816; b=LOkOu6zPONtybN5Tf/FMCHGE7Nq3ST+2WT3KRv7kaFZwOubjlWZKyua06Qi+hz20/B GL7FFfrmTDajvhFE0jW/ohx47J7I4XtM83HxbvZHYmZjdeUtai7xohNjtAqS0NuCgrgD mW9qsXGYpurebhmD9unk9mgB9CxMRPQJgddf0YVuzDXtdymMKiWiODt8caRgKhqbcdnA OXzIqSaVVlAXItueCefhDpCgeRwOjfEJsREKHTBu2RVDpf2H8hHNV8hHngW4PxAKFchQ WLW/UJbdzTsWpEsxKCR4OEhvf4W7V3zDXy+WNKRMy5V7y/d3U5+vaJdjg555vFIab25j /NWw== 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=+429EFrOlKpQdCsPcJU+dtfRrHdWcxXG/CLNawrJO8o=; b=NA3UE320q+Ivxmkd/j+jMQJ5RshIURx8hMIl8ZgeI2qSvzlnK5mY1KDDgR1Z6Nm5bS RksRUjSzYa6sf56Gxv64DRIJpA1iNSNmcE/KGK1JCGOIVwRT3+h8ojHVXtdupPNzTjRw I63VfY6v+jTr4DtNz+oBDhO/Hph09VStrdfd6E8TsNJ06in49eq0pdXp1e6l0CkxCrkf EK/rBixgm4YeJsGi508r/5xDYEc8MVaSOI0deFLmf1Q3eEku14CARYNzS5znQp7ykAa0 MGeAuXZSnwvEElpQPtezrpZ+97G3A75bygUf+GtTW0+Brf/j78OwzKSVhUDUC3y4lkS7 db1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DyDRKRQX; 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 l20si8545334otr.227.2020.01.14.02.10.16; Tue, 14 Jan 2020 02:10:28 -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=DyDRKRQX; 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 S1730979AbgANKIZ (ORCPT + 99 others); Tue, 14 Jan 2020 05:08:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:39722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730960AbgANKIY (ORCPT ); Tue, 14 Jan 2020 05:08:24 -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 2CF0020678; Tue, 14 Jan 2020 10:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996502; bh=JqCYsh26Mk9/vcxTTruMptcg0CwCViC/wGsnxWhfASE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DyDRKRQXz15Z5OQaIePueWFkJBqGzTQ4bE1RuHYaoBYoW1VM/h4BOVRt5j30zdqNU LYVXgC0jAz2wDu1xfD6fvJJBu5V4jwg8rb59dIsItjB1dQ7l4WAgKqSCQ9AuDDrDrz 8l0MYhf1z2AHI6XMbR+0XPlAcm6tyfp3lVGG5dSY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Dmitry Torokhov Subject: [PATCH 4.19 15/46] Input: input_event - fix struct padding on sparc64 Date: Tue, 14 Jan 2020 11:01:32 +0100 Message-Id: <20200114094343.665406071@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094339.608068818@linuxfoundation.org> References: <20200114094339.608068818@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: Arnd Bergmann commit f729a1b0f8df7091cea3729fc0e414f5326e1163 upstream. Going through all uses of timeval, I noticed that we screwed up input_event in the previous attempts to fix it: The time fields now match between kernel and user space, but all following fields are in the wrong place. Add the required padding that is implied by the glibc timeval definition to fix the layout, and use a struct initializer to avoid leaking kernel stack data. Fixes: 141e5dcaa735 ("Input: input_event - fix the CONFIG_SPARC64 mixup") Fixes: 2e746942ebac ("Input: input_event - provide override for sparc64") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20191213204936.3643476-2-arnd@arndb.de Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/evdev.c | 14 +++++++------- drivers/input/misc/uinput.c | 14 +++++++++----- include/uapi/linux/input.h | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -241,13 +241,13 @@ static void __pass_event(struct evdev_cl */ client->tail = (client->head - 2) & (client->bufsize - 1); - client->buffer[client->tail].input_event_sec = - event->input_event_sec; - client->buffer[client->tail].input_event_usec = - event->input_event_usec; - client->buffer[client->tail].type = EV_SYN; - client->buffer[client->tail].code = SYN_DROPPED; - client->buffer[client->tail].value = 0; + client->buffer[client->tail] = (struct input_event) { + .input_event_sec = event->input_event_sec, + .input_event_usec = event->input_event_usec, + .type = EV_SYN, + .code = SYN_DROPPED, + .value = 0, + }; client->packet_head = client->tail; } --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -87,12 +87,16 @@ static int uinput_dev_event(struct input struct uinput_device *udev = input_get_drvdata(dev); struct timespec64 ts; - udev->buff[udev->head].type = type; - udev->buff[udev->head].code = code; - udev->buff[udev->head].value = value; ktime_get_ts64(&ts); - udev->buff[udev->head].input_event_sec = ts.tv_sec; - udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC; + + udev->buff[udev->head] = (struct input_event) { + .input_event_sec = ts.tv_sec, + .input_event_usec = ts.tv_nsec / NSEC_PER_USEC, + .type = type, + .code = code, + .value = value, + }; + udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; wake_up_interruptible(&udev->waitq); --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -34,6 +34,7 @@ struct input_event { __kernel_ulong_t __sec; #if defined(__sparc__) && defined(__arch64__) unsigned int __usec; + unsigned int __pad; #else __kernel_ulong_t __usec; #endif