From patchwork Tue Jul 25 20:07:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 108688 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp14291obm; Tue, 25 Jul 2017 13:07:51 -0700 (PDT) X-Received: by 10.84.234.15 with SMTP id m15mr23229293plk.247.1501013271342; Tue, 25 Jul 2017 13:07:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501013271; cv=none; d=google.com; s=arc-20160816; b=M8DSlxMwE35YEfD6WDJGv3wI0euyDeJU4AlxCdz5SK4/62KWHBRRvKzXSDBz6hNh3V SjB3iXWmZ/QPPNQORT081nRw4LwaQIx2EyeboQMgeKFtOnIMg9McxZBo00r3j1eGtgyS 1raHI/81mdJ0+Z3djhJ3vBOEx0SmflPkP44YLWwB2wvIcvUY8jM7tOQ9K/HoJBS/h7Jt Ni1IZJaiyVZkTNlqA+NhE4GGfk/Y6aSDiZwNSwL0qAMfLh1z6PbjRv4dwlwsbrqps2+9 haIXOMKi/xKt/1+IgmY5UrXEZR6r5+8HtQ+3DJPIbc6LTvdI0BC1fKFNSJjTc75yyb9w 1RFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=sVZUJleVJ69d9TksGYVmaLIPvCBhN9p6gI8tvLi47vc=; b=qDh2dtLK9qodrwJ6iQxkit11hscHnL9DFt6bqG3mKw1dkUk/G7KynRCxA9NDdd2F4V xDKOrl1BQkx1fOYEChn0TqyXOZgUxvZi6V5Q3XdUaKv3ypQkTR2oSUXJDjH7VyoETCBt 5IEYriJ/TsukcugutmnOCd3cMgaThMczAwT6nfpw6jnm+eV6Nm8uS0ubj1417cna4MiP wVJWBw7uqnYhfO0ZXhcAg01VNGTiBZHeRz52ndm/OXwQrH+As6Q1ln4GtzoUAF2lEUrf cGHafWGYXBd4xxBMESAc/d3ZR5AXHdmO6IuN18DSkLsQ/151LIXRMzg1/QQg/hlpR69R RtBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=LdxU9in5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10si8970990plk.237.2017.07.25.13.07.51; Tue, 25 Jul 2017 13:07:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.b=LdxU9in5; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753259AbdGYUHr (ORCPT + 6 others); Tue, 25 Jul 2017 16:07:47 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:38484 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753251AbdGYUHp (ORCPT ); Tue, 25 Jul 2017 16:07:45 -0400 Received: by mail-pg0-f50.google.com with SMTP id k190so8950309pgk.5 for ; Tue, 25 Jul 2017 13:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sVZUJleVJ69d9TksGYVmaLIPvCBhN9p6gI8tvLi47vc=; b=LdxU9in5DMvvykANq2S8tAwZIgPTulrGT4hMgIJ/WHaDkZYPzcApsG5yGrAdBhRrl7 BuGYoikYUq8lhTo6RNs/Nj0xcL0YsnvrK/X/u5bhcX7Piof+hVdKqIcU9iUHu0cEAPZr F7SCcSpawmA4v95I8in9G2axapRn/Cw+ouvRY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sVZUJleVJ69d9TksGYVmaLIPvCBhN9p6gI8tvLi47vc=; b=IMiehzBR1TG+zabmgFpt/VG7mv/AZ/3cF7tfq1HECMn/vuAzyRda0gF+jbkThT8K0+ lgf71Visgiq/imgCpWh9qgMpXvQiTdrSSrsb93ml0rR0OcCSWtoN8sTd/tPHNVJNW6FP +3CiwrDdTtenrXP7/oprdJjZKYDyFIKLRJXGR4GVQ+rbH1SnF7alUDNzZ+eWRK3EtY24 ryy3y7G/y/6INWaod2OBFMRogzZosF99HnlLufOaAn9z3BnpYppnPAro0JyR8Q3eF2Zm SCHYcXcl0B7FfXUyLewVkZMn9GUMBwWgSErbhcSvPLpCDFQHI3rvMiqhGo6sXjKyP2Zn H1hA== X-Gm-Message-State: AIVw112gP838beB1bS8xQwKkwxV4nzj7TOFMi4QtY+R3Ae/ZW7WUWWea q0v9/xDO3Ci5DRcY X-Received: by 10.84.209.226 with SMTP id y89mr22524747plh.290.1501013264532; Tue, 25 Jul 2017 13:07:44 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.235]) by smtp.gmail.com with ESMTPSA id c76sm27684356pfj.91.2017.07.25.13.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:07:43 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: Stable , Sudip Mukherjee , Sudip Mukherjee , Samuel Ortiz Subject: [PATCH for-4.4 06/13] nfc: fdp: fix NULL pointer dereference Date: Wed, 26 Jul 2017 01:37:14 +0530 Message-Id: <1501013241-31961-7-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> References: <1501013241-31961-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sudip Mukherjee commit b6355fb3f5f40bbce165847d277e64896cab8f95 upstream. We are checking phy after dereferencing it. We can print the debug information after checking it. If phy is NULL then we will get a good stack trace to tell us that we are in this irq handler. Signed-off-by: Sudip Mukherjee Signed-off-by: Samuel Ortiz Signed-off-by: Amit Pundir --- drivers/nfc/fdp/i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 532db28145c7..a5d7332dfce5 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -210,14 +210,14 @@ static irqreturn_t fdp_nci_i2c_irq_thread_fn(int irq, void *phy_id) struct sk_buff *skb; int r; - client = phy->i2c_dev; - dev_dbg(&client->dev, "%s\n", __func__); - if (!phy || irq != phy->i2c_dev->irq) { WARN_ON_ONCE(1); return IRQ_NONE; } + client = phy->i2c_dev; + dev_dbg(&client->dev, "%s\n", __func__); + r = fdp_nci_i2c_read(phy, &skb); if (r == -EREMOTEIO)