Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5020412ybl; Tue, 14 Jan 2020 02:06:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzFbtMowz24Xtk82b1RInlniGJup8tav/EAEBi06/SCGGnl8h/aMQHdnk8Wjh1S1EAdzQco X-Received: by 2002:aca:2210:: with SMTP id b16mr15402984oic.32.1578996376236; Tue, 14 Jan 2020 02:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578996376; cv=none; d=google.com; s=arc-20160816; b=xHRVmNhugkKSdNM2Ej6nySYk+KlkRNvVZ7AYQXi4L6E5bftldwraC7xIP6R8E7nzmK rbYsG4aarkBwPu6wBKie6B0tRPqFl8ocfPUKxDjBB3DZvegmN6vVw/fOgDids3dMItJr UHbsc4aTCIZZ5rAYDQT1nKsPYugON2GUDvm6gSFakp78GxkwMEhNq8mGcDAXSYFiAuFI IhxqCwD+IBcorhDLR9fec5DtCiurJe8jOdameO4UZbHqyfC2of3GxNgQKGQ6PfkpolVK o2xXIC8P3qd/3tHP2zYpTlpfVAMLAXm5CD6JT1pccPP3WMKhcZvRybgGkouGK/yXZu9/ u8Pw== 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=XPAny4sko05WyoC+r+h+pgTnCBmbiFqTtClyGSnZJps=; b=fQbvV6ReXG1lIssFGcOBY8gMyqsTlI0v4KijNTedxZpSy+7nS6kd1GO7VFBzb6hqzc vryaJfhmX4ljS2E8jdjoJqZRVbIEiF/F2ismnWg9bY888lbjHG5sc2DsrqVd9sTm75sp MvjIuEIirGPH66l8KeCK2OydiwnHWMnp08OM+GOWvZYEwNTbNxmsrLKBdYo21U17b+Kr 43yvaUI7d/kPOT1aoUXudzZH2OdDp4v/oea2I23cELio7TCJ04tTFVd/d3kaivn7y9Zt BvCTRyHDVayDtFtr6rfXZAVLYv6YU+CdRNPvIlhcdxA4Nf1DIfefJt+8YlyoI0z8o9y7 NkxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aRKAurVI; 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 q6si8829833oth.26.2020.01.14.02.06.04; Tue, 14 Jan 2020 02:06:16 -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=aRKAurVI; 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 S1729940AbgANKEq (ORCPT + 99 others); Tue, 14 Jan 2020 05:04:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:60514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729913AbgANKEm (ORCPT ); Tue, 14 Jan 2020 05:04:42 -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 60AF82465B; Tue, 14 Jan 2020 10:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578996281; bh=/9BlWLeSYpZfRll16yytSYS145pvVoN7Z4UYrmzcAQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aRKAurVIHCo98rsWwHexjrDxgC47cgYLtCT7YXQ7Djy9bJW//CicdhLDndQFPIziD rXy9QK6CyX8pSLXV+u9KKV6INFsSkDAo8pEUtGiKR4M8OVNMywN3KH9IY6jfZr70GZ w/fLybn8s8d96keQdSH30ERwh4H2792HUJSAobpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Dmitry Torokhov Subject: [PATCH 5.4 22/78] Input: input_event - fix struct padding on sparc64 Date: Tue, 14 Jan 2020 11:00:56 +0100 Message-Id: <20200114094356.728628313@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200114094352.428808181@linuxfoundation.org> References: <20200114094352.428808181@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 @@ -224,13 +224,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 @@ -74,12 +74,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