Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp620654img; Fri, 22 Mar 2019 05:18:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAzmh5+5B/eBTEvTWXY5bTlmJY13heeqszwvxItonmGf8Md7KeTuxmaX5b00GsbTfehzx0 X-Received: by 2002:a63:f212:: with SMTP id v18mr8761400pgh.261.1553257126976; Fri, 22 Mar 2019 05:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553257126; cv=none; d=google.com; s=arc-20160816; b=U6OXejyMunc1DPV3VVEBpPE7PrXemi5x0dW4kyAC+xix1Wp0iRrm7jKGLzqboj/tpx I0QZEvyPGupiun07p5zP9BnTO6Tw4FCw6Go7BCmtBZU32iGW/ka5Lw6io+z6TYfXMfN+ xM+0Hkq3NcY0H9G1LATMA+ckeshv6ikYz6qRuZydjt+5CeHUdzepiQJALx2aMpKy+RJ6 fj76GSqISVtezoPQ93RXeZfblVBSXmZ1XPc0+MUh4RdKsV/LQKvQWuesT6a3em3bEgKC UjQm0wUuJRu6Bab/jjt5xtDFqQ07cVcnITvVL1gM1SITGYoBW5s0sVERGxdprMNVAzFJ L9Yw== 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=99bA1eCw3yY4eqLpxTpB1kozCk87oN63Q1PtQ0mLJWU=; b=K+BfyyMOUxVR/PMMHw/QmcWJhBh8yw/GSH0jB1LUeBcHZA/4z8L/K6zcceM0Dw2HSO 6hLWIFoqTMJKEF29AcA/hJ7Q6LroXdjj0KzW30Uoj7xsJRy9daPEk8N5fxSDKAKImZjv XJPsBmPWcVMiWSfXjp6JJ1V4/bRdAhYyd8TPbjuogqyxSxKMJRkXZNaDDt6tP+uUR0u7 paulGZTLlV0/kH2usgs78vssZjIzbmGHDIIJtsKpVsBmvzuL5PCipKu/MEsreYbfStr3 byjlV1wsolYKXRomy1uZUPiGM6eFAP3COQC9+FNE5al/M1hAMxJU4JzWHdyyK0gVjf9W Zjng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wztqbj0m; 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 y11si6410875pfm.119.2019.03.22.05.18.31; Fri, 22 Mar 2019 05:18:46 -0700 (PDT) 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=Wztqbj0m; 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 S2390418AbfCVMRs (ORCPT + 99 others); Fri, 22 Mar 2019 08:17:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:56686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389940AbfCVMRq (ORCPT ); Fri, 22 Mar 2019 08:17:46 -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 8959B21900; Fri, 22 Mar 2019 12:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553257066; bh=3xQ6+0tMkP0xGagftQc+a0u+ihHU2NMEowSpa+VcYrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wztqbj0mJ1r5STsnt/NROFOJhZCEzRFiI5XR8hNylQaVI3+eUQhjQIW6fHGCV4hoi MxO5DL4iQR55kuakM8Q+Duux7ID8zdmHOisBSAg3EOoxXQEsECo87XQ5YYhRe4s9G7 sYx7H4Pr1JVqAduEWIV9Zzgb6qI6Kk6VLslE7CmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Walton , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 5.0 120/238] gpio: pca953x: Fix dereference of irq data in shutdown Date: Fri, 22 Mar 2019 12:15:39 +0100 Message-Id: <20190322111305.608632715@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111258.383569278@linuxfoundation.org> References: <20190322111258.383569278@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Walton commit c378b3aa015931a46c91d6ccc2fe04d97801d060 upstream. If a PCA953x gpio was used as an interrupt and then released, the shutdown function was trying to extract the pca953x_chip pointer directly from the irq_data, but in reality was getting the gpio_chip structure. The net effect was that the subsequent writes to the data structure corrupted data in the gpio_chip structure, which wasn't immediately obvious until attempting to use the GPIO again in the future, at which point the kernel panics. This fix correctly extracts the pca953x_chip structure via the gpio_chip structure, as is correctly done in the other irq functions. Fixes: 0a70fe00efea ("gpio: pca953x: Clear irq trigger type on irq shutdown") Cc: stable@vger.kernel.org Signed-off-by: Mark Walton Reviewed-by: Bartosz Golaszewski Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-pca953x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -587,7 +587,8 @@ static int pca953x_irq_set_type(struct i static void pca953x_irq_shutdown(struct irq_data *d) { - struct pca953x_chip *chip = irq_data_get_irq_chip_data(d); + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct pca953x_chip *chip = gpiochip_get_data(gc); u8 mask = 1 << (d->hwirq % BANK_SZ); chip->irq_trig_raise[d->hwirq / BANK_SZ] &= ~mask;