Received: by 10.223.176.5 with SMTP id f5csp974918wra; Fri, 2 Feb 2018 09:06:50 -0800 (PST) X-Google-Smtp-Source: AH8x225tOnF6jmfb6XdXfeojuZ7JMzq8RkUrkYRZKZZIdgqTkn2LKX86zBzRpeaPH129kq1QcT1P X-Received: by 2002:a17:902:b685:: with SMTP id c5-v6mr4876357pls.174.1517591210511; Fri, 02 Feb 2018 09:06:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591210; cv=none; d=google.com; s=arc-20160816; b=XsEJXlsKAf9u0cysfeOK5BxYWyeYQwONL0Mdotv7TIVBgBqi8zW24hwO5MStCUTFXh zBf9zrDS5IVrtmzdjTzg+ymIkyU1YTjfBVifHI/CP1x1BTpPJdVPgRoPPtRcokd15GNG xz2blzfmf6l5lFRwOt6sdeXbCts2/INSggvrqD4/p4iiJOml6SmKdOaZioMxwYaWIJtC Qgz1s1Hp9OMLc3jDcVrw0V91MhhPBhxsw+3sBT2KmlKdc2cq/ejeGADdYg5/Nt0XffLb I2PdQMc+I4oPmQsJc+WJJxxlkN94qn9GwlDuUbRmARYYtVRnaEW5Zzez/hd9S42Hl3hp wx0g== 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=VIlFVEsBGzw2HuHH61jd4ACK9uIF6TMn6dtZ3cfLiBk=; b=AvEEUBvQIeFnHu4WDYT5EFfZQXrw9qk9SHsEEDqUMsIizBwYlBZZEXSICbBw+HCSut OKxZrBjaYFQOVpJEiuSzOSe+4DdovMe8b1NAon1tXCbT4QT4TohlEA0RZMiSO3Elx2Yf 9HHeZ0nUzK2k3WSOClLGDXJu//g1insHHQkJC4zQ8/BLhN1sBSANAbTUGpLisKStwwGA 2Jpur/WTNaY3O638/gg/b49O7htapNXAwKfOxILhdnAAYu7ZfwkHad/43vYBVpVae524 WW6z35RVd20CvauYG+49EiGdUrYOiuZP/OgTTrOq9qLj2UJ34R8NNKgheAa056ihqBUA x/qg== 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 f30-v6si45646plj.658.2018.02.02.09.06.35; Fri, 02 Feb 2018 09:06:50 -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 S1752597AbeBBRFy (ORCPT + 99 others); Fri, 2 Feb 2018 12:05:54 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35630 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752802AbeBBRDI (ORCPT ); Fri, 2 Feb 2018 12:03:08 -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 1C90AEC4; Fri, 2 Feb 2018 17:03:07 +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.9 06/86] gpio: Fix kernel stack leak to userspace Date: Fri, 2 Feb 2018 17:57:26 +0100 Message-Id: <20180202140823.289348141@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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 @@ -705,6 +705,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);