Received: by 10.223.176.5 with SMTP id f5csp1016887wra; Fri, 2 Feb 2018 09:46:18 -0800 (PST) X-Google-Smtp-Source: AH8x224xamX0A9ll/vfBNrPpDZfGq4oipsBej1TV/X0tfmWP07+1ISGqViLOxRUQuyKFWrVq73JO X-Received: by 2002:a17:902:c01:: with SMTP id 1-v6mr4504587pls.55.1517593578646; Fri, 02 Feb 2018 09:46:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517593578; cv=none; d=google.com; s=arc-20160816; b=fBGnViJ97lC2vMyS/ZmuIhNVEb8fsPpC82f/EPV9HiI5pPFHvN8B4LhRHyjMlAOxoK 56MfT85sPfPZawF39T54x+i3Usa/0SfC5DkX7c38YtnWSe81N0Lwwh6uvQwsi4KNQSPR 8/kQ07+b/9sfvlaU9wOBTAjZ2s10Q9iY39ERJ7sJZ8bV3BzN01VjF+YNxEC7Hv8Qkj5w 9Qyht/ROtd8nYMemW0DJtBt2EDKum1deX28kM6xwtIPoNG8huQ4uj2awdfLViEkU6koX 8bLVB7jQtuSMQ5W5JNl4zp1QbwU9pl2sXRS40ybDCz8XSLnFmFmgliZzrOD1gRhfKpsD YBnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=fMlEblNVby3vinrLbHvn52/NPHa6RjVAueED1cPHNWI=; b=JudHOykseY6q3yFJ7T5WRsCOpOM+91MsYSY+xTJldsmIZtIJiEwkLScTCdm3HASwwk uzsUEyx3sth+9+mfviJrenWnf1sFWWwL3BPIo+ctVPFxXF8zSZw5S7Tr07JwuRV0Xnnr UMh3rcrZw8Do+MCJMEug4iQzyMN2lBgH1fXjvjzxQ0Jpohfwp6imq+FLAHOJ+v03LGxf zfDnypXcA/9CvmQag3NhKfHH4iEu5J1pQ9h4Y8pDKCpgxRRijxyW/WNtPGYArdnm5WhG 6LOUsft16GFIzeI9MXfwOu/R3UpQkwfQHVVh90bGd6OY2r+B4YVjTWLRGuAokOjL1ctB BaeA== ARC-Authentication-Results: i=1; mx.google.com; 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 m12-v6si2097452pln.737.2018.02.02.09.46.03; Fri, 02 Feb 2018 09:46:18 -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; 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 S1753662AbeBBROn (ORCPT + 99 others); Fri, 2 Feb 2018 12:14:43 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37302 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753020AbeBBRIZ (ORCPT ); Fri, 2 Feb 2018 12:08:25 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4B511EEF; Fri, 2 Feb 2018 17:08:24 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 4.14 006/156] gpio: Fix kernel stack leak to userspace Date: Fri, 2 Feb 2018 17:56:27 +0100 Message-Id: <20180202140840.599129976@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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. ------------------ From: Linus Walleij commit 24bd3efc9d1efb5f756a7c6f807a36ddb6adc671 upstream. The GPIO event descriptor was leaking kernel stack to userspace because we don't zero the variable before use. Ooops. Fix this. Reported-by: Arnd Bergmann Reviewed-by: Bartosz Golaszewski Reviewed-by: Arnd Bergmann Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpiolib.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -723,6 +723,9 @@ static irqreturn_t lineevent_irq_thread( struct gpioevent_data ge; int ret, level; + /* Do not leak kernel stack to userspace */ + memset(&ge, 0, sizeof(ge)); + ge.timestamp = ktime_get_real_ns(); level = gpiod_get_value_cansleep(le->desc);