Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3187126imm; Tue, 17 Jul 2018 00:00:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdLvoXd+MQIq6B6W6IMqDMdbdt9VdRfgQB8wrjhypWj0q/VycjExak3qIvEBCffX9UbYU9U X-Received: by 2002:a65:6343:: with SMTP id p3-v6mr444996pgv.48.1531810805850; Tue, 17 Jul 2018 00:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531810805; cv=none; d=google.com; s=arc-20160816; b=mq//1UygZsMqTrVviLWXWMZYuTWcCLLRTkjrzXyvw9X1PEDQov7PItvKMRnlQ5Q0WM xb0qUN8K9vPaF/4mdCgqJ91FEswW3Vlzq/Eb2GSn6N42yD4B+1m/0aK880Nv6srPNSwY foa0vQG3MBx6RAHOXlF7eepADpXEHasgzxYg5fi9hJns/BibiL2Kui3ENQUibVFTGFOp YN7qp4FVxi/a6MnKCkeVaHXN3h9/btbHiatDJonXHO19QI+2ZMhISLyD545UuVx11zzo k70iW4tKeN1VUFm9cUr8GXqtO88AJaScXIZe//JrwTK83cwf16a1sk6uFmw8xxL3vK3/ 2/BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Z/yQXtVErqGNfHWNXKkyKBEpyU8wnR1elDva+eToLcU=; b=H92HVw6E4bkvjxSzp94j2uxYp4ZrHOn8J27gP+o315vlc3M1U/ZsVXfgym0s0w4Ld8 ZrztcgdGKAbkGnXXvcVrKri+RCkmV+NMV3xuLgrBO0Qb9FRwQnQC7wRmmNENHdMbZRDV +kky66CWBFGKzbmmwvj2KaPrvgUu/aR5Ju8ffvIk+TB5AnUH1CQqmqN/AuhwZ7eUMwI+ QhW/QYhnDbqA2w6+YjOqrRzTDAb76TSLbjpjIEZHK01pyYZ2gSAS3tK9ZSKwCzXhm9fr kV94rVJFhy7krLCjIFgapPkaHi+nkbLVTfLFW7o13+ns9iVOoyUe6PVyogFtqrYjpMdL z6RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NuzIXXuJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16-v6si205130pgk.449.2018.07.16.23.59.51; Tue, 17 Jul 2018 00:00:05 -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=@gmail.com header.s=20161025 header.b=NuzIXXuJ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729695AbeGQH3H (ORCPT + 99 others); Tue, 17 Jul 2018 03:29:07 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:32941 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727625AbeGQH3H (ORCPT ); Tue, 17 Jul 2018 03:29:07 -0400 Received: by mail-pg1-f195.google.com with SMTP id r5-v6so32554pgv.0 for ; Mon, 16 Jul 2018 23:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Z/yQXtVErqGNfHWNXKkyKBEpyU8wnR1elDva+eToLcU=; b=NuzIXXuJitaWxY0HXdSdpGGDBMsMY8nW9XjpoPywZaIpeQzn8SNBTf751j3V4aHbfp xieQzgktMrBwsrnjYTSajnZfkFIN3bDD/0elphvwHxQsE23vukW/PNBtj+0379T/J59I jI/w/Y8HgnSIop0pIn6Gf4xkXBM/5k3+aix2QWVpwNWvWWo3nM0/Sl3t9kql9rEkBahU v5zkrEQ9ql+o58DtqSwTkortmO6PQk9TsHDSpwJ73NY2wsTE7YPk9CT80JIiXnctYTlc jeetbQOc+XNyzGLN4YSNQASZ83ruB+u//6TGG45n0HFqCMoFiFJJiLz8bGN7tzNtkDy7 dSww== 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; bh=Z/yQXtVErqGNfHWNXKkyKBEpyU8wnR1elDva+eToLcU=; b=Wn67hjq2kZhqu2L1Jju26KB6KL2ZBtXbjm056AIx6utb8gX3VwOf6Fv0/urtjJpElB 8CfyF+zs+xgD6oqKQqrcGo020+gPjm2IHA1/hm29C93VBWgjd6hTz81VppyA8y1y164e 2QMkrj7uJK3tVbbPNToLwZ2fSOorPbQnLei98nizgtt3I/gjkQxu2wfqrkFNfkwbsTxi AROPVYP1UbNmhpuD9jiDu8OlbV2GNORxNSXqLaWlfkZIFxY6nRi1vcvGdh4QFiBb929A k0V0kiIV835kOK3riUaaLrk1SYWmp3TcdYt0UXPLuYTLx76koTXpOGCA7mxDrAah0u10 prDg== X-Gm-Message-State: AOUpUlF0EDrsPrxyf7raxe7EJ8gL4eqvDdwz9zatmdELFOI6ptwn8Kph 4jF3icH6zM6eYW3h8P9LsGHdvib+ X-Received: by 2002:a62:4bc6:: with SMTP id d67-v6mr413228pfj.175.1531810681185; Mon, 16 Jul 2018 23:58:01 -0700 (PDT) Received: from raghu-VirtualBox ([116.197.184.11]) by smtp.gmail.com with ESMTPSA id l4-v6sm445976pgn.46.2018.07.16.23.57.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 23:58:00 -0700 (PDT) From: RAGHU Halharvi To: linux-kernel@vger.kernel.org Cc: RAGHU Halharvi , tglx@linutronix.de Subject: [PATCH] genirq:Dereference desc after null pointer check Date: Tue, 17 Jul 2018 03:57:25 +0530 Message-Id: <20180716222725.14896-1-raghuhack78@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Remove unchecked dereferencing of *desc & assigning it local irq variable * Move the assignement after proper check of *desc for NULL pointer. Signed-off-by: RAGHU Halharvi --- kernel/irq/manage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index facfecfc543c..064d98e5ae32 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -1557,7 +1557,7 @@ EXPORT_SYMBOL_GPL(setup_irq); */ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) { - unsigned irq = desc->irq_data.irq; + unsigned int irq; struct irqaction *action, **action_ptr; unsigned long flags; @@ -1566,6 +1566,7 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id) if (!desc) return NULL; + irq = desc->irq_data.irq; mutex_lock(&desc->request_mutex); chip_bus_lock(desc); raw_spin_lock_irqsave(&desc->lock, flags); -- 2.17.1