Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2567572yba; Mon, 6 May 2019 08:07:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvX9aRWGc/RVa/M0jUIBBEhFmmg4ruxJnQQ7RV3bQGAzgAkI/A+zXMmZI5+MYOjpBPVKsG X-Received: by 2002:a63:5d44:: with SMTP id o4mr32439699pgm.15.1557155224659; Mon, 06 May 2019 08:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155224; cv=none; d=google.com; s=arc-20160816; b=WthOakv3rbRfR92A1M7yFSygeYX+PnnTF25awH5Z4tzUfci8iF/ErX584lX/1geGgc 5mBHQbKfzGLJ92/g5sMNM6r3pYGLHpIwn2QztdWy9Jz9IrM80Ex5hLHlbrOz6V+2y0Wy ji0niGhYluAn28gx25/VixgpyTeNJRCmvSDlgShJwGJ3I/JYfkUkP/nHKz/sKYajNn9k 50bC40cvbSCSx5tcxlFZiKVn8isbwDmiFM6oxAhmPAG9TU0rkQSx+hyxnRDzHvc0pwVG 3XwwfvHeUUxpufEyqdo8guW4ZM5XNBHipmDD0zgP7UBlwsOqBz5Pu5p5tziYaafTbH8z jmfw== 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=vKJ7Aby3/AUIaascMo23fwm+RFM2kcWUclTrVXJTG+U=; b=r2IUBuI0gmL0MazpbM8b0PLq9sTrUDJrFMTgY+FBjgzy72rXYYUevAQL2LVh+b0zjT aRa9ToJ/lkuXY6008ERaWTtOO3erh8u1/xJ6crJjSbEI1HpdbX4NJX0pjp9EDL+PdFAI xOiSVfwgBcZC454+tRX8XydXCKb4u8WK518vOMVRUOPwpz9oDBngExbBI3q8z8XF9X/F isLqXX7UXc//3yR51qNPbrEwYE8wHk89MUX5v7xXIEmQHRBUFUnsy1GoTQhjGrPaQeGF 9nb+DD5b/wa2eVvmSGmbiDEoa6r3uRLQPRWM44VgyqhiF1lFwzVIkkpR8h/0BDdrbv+h NJQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BfZ9hj78; 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 q16si4385898pls.256.2019.05.06.08.06.46; Mon, 06 May 2019 08:07:04 -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=BfZ9hj78; 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 S1727561AbfEFOiU (ORCPT + 99 others); Mon, 6 May 2019 10:38:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:59208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbfEFOiK (ORCPT ); Mon, 6 May 2019 10:38:10 -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 65BA121530; Mon, 6 May 2019 14:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153489; bh=Cme42BXyM5B/axh0ikcg14fPMotlgAYQcMcYvYb9TJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BfZ9hj78/24yrzP2eaxnruruRKelLFGNYYdD8gF1VKG7Omt5QJYAKJnBbM1tAouz5 NOFgQ/qqb8BpXsZaTGNqshJB86s7gCDZKJmQs+KmRuQkqPJKCwd5QOLXgL2aRKZBPZ pO8i7Kul/JXLRM0wpJDjgHo14shZG3g2ep2C7K0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anson Huang , Dmitry Torokhov Subject: [PATCH 5.0 109/122] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ Date: Mon, 6 May 2019 16:32:47 +0200 Message-Id: <20190506143104.321484206@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@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: Anson Huang commit bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 upstream. SNVS IRQ is requested before necessary driver data initialized, if there is a pending IRQ during driver probe phase, kernel NULL pointer panic will occur in IRQ handler. To avoid such scenario, just initialize necessary driver data before enabling IRQ. This patch is inspired by NXP's internal kernel tree. Fixes: d3dc6e232215 ("input: keyboard: imx: add snvs power key driver") Signed-off-by: Anson Huang Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/keyboard/snvs_pwrkey.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct return error; } + pdata->input = input; + platform_set_drvdata(pdev, pdata); + error = devm_request_irq(&pdev->dev, pdata->irq, imx_snvs_pwrkey_interrupt, 0, pdev->name, pdev); @@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct return error; } - pdata->input = input; - platform_set_drvdata(pdev, pdata); - device_init_wakeup(&pdev->dev, pdata->wakeup); return 0;