Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2837675ybi; Sun, 28 Jul 2019 19:09:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUPEgQA/ngMI1XW+EaTR+quHUAPh1mNt1XmKmSETazuFOadlf41LbTqP81D4z7IGE99Cqg X-Received: by 2002:aa7:8f2c:: with SMTP id y12mr35248100pfr.38.1564366189291; Sun, 28 Jul 2019 19:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564366189; cv=none; d=google.com; s=arc-20160816; b=d5ZSaIXj18ggjfaXltEN/7lRro2OIDkLt1EWW5/dTP6zCYRwFDd4qcqOXNOUrhki84 chX9rlMpPBtRC2XSDJJ7npnO6Le8UoGwDnf5EYM60awzJq2rBbBZHck4U3zQZxmSqbju 6wS9JVPOX10O6M/Dx1tHY8Dvub03XiV65KSMxcqZz62AxJBdSF95cg3OB+IktcCwEXxl CkWIOcDaxyy9+a7AItvSm9sLz2/oSpn1y0aDyo4lJ1bsyQbRUu5R0PXqRy2p4jJBk4cO dgZeUQcnEmWME17jEeDJlR+8P/qd5YpN3FLIQnjmZrGl/XegxAALu3Sb/508XG1PkzoE 7MxQ== 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; bh=GgqqXrj0IVL3XCjuqMEeh46rLbd7N7hEVY5Hg1vftSk=; b=w6HWlFY3Mm8DNVUnmXyRo1MT93hTCorKzBMxOjcoZztIIa79HQedrMLW3YhOW29FXl UO4CgiPIIbeM4L+nEE4Cp3V8AUdFttBs5Bfrdctvc5WrVcm1IbsjbKIf444DSBV0K9Ya Vqkl36Y46iCtJtc0hAYuCTTAVFhakUuK7l7zUh9otn/1D05242vyWxWOUCqQkArjxoRV fE3AN4Qw0ZOY0APIImT6i57AN/OMewMX5xyI8vfTkSG3W++v3D7rOZYkZDf3qRHptCfa kvfv0OE/kTc6sh+Z7WNmDst9i/g6dHhXmM1EW4WfjdUCKZKwoMn0eU1pWbhi7viAW633 cChQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VhQ24Xm4; 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 15si18770543pga.575.2019.07.28.19.09.32; Sun, 28 Jul 2019 19:09:49 -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=VhQ24Xm4; 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 S1726300AbfG2CI6 (ORCPT + 99 others); Sun, 28 Jul 2019 22:08:58 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36086 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726216AbfG2CI6 (ORCPT ); Sun, 28 Jul 2019 22:08:58 -0400 Received: by mail-pg1-f195.google.com with SMTP id l21so27389693pgm.3; Sun, 28 Jul 2019 19:08:57 -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=GgqqXrj0IVL3XCjuqMEeh46rLbd7N7hEVY5Hg1vftSk=; b=VhQ24Xm4qxQ1CYPaB6WhF5IedavT1hfH+pAW+nNKczx/aBxtKhr9dgC0SKzTRe7Ki1 Q/JIQnvaFXbFkPQPNUtjOH9TiNTZxLeArg10E3/dbQT5HukCE3gU6ogpsY0Xe023uXaB xn6L0Njlqzzes1/8U6W8kkKjqQWd09QkV9vm68h+BXbnNyszCP9lzlVNMEulf7UTfHVd r6c/3wkyPbUYYHd411oyZDnVh08fs0lVD0Tki4DtGEgvvM2GURS+ibiV/DJcHrma8HIU g/7LUwI7OneWn3HokbE90LPxQFDugrsUgxA8SSO9yUJfauib0nV78nnai5iBhOqMhig/ QmQQ== 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=GgqqXrj0IVL3XCjuqMEeh46rLbd7N7hEVY5Hg1vftSk=; b=YTtsZdVqAT+oNTb226A4dkGA/wjs3+wDyJeEWgpDuOvVpFEssrFyDTcIiJh+5unUFE tEnSfCu//qrGe22KCBhYgdeVEaCE3ocQyA/5mCirq1itXgtLPKugxg6qKby3HZ4MAxUH DmJjL0wWYW3B6Az2LxE1sxaBbhPpkHiuMip0isUBQppFfEbp0ZgTs8DLidoeT/Cd2Uf+ 4jlpHYe7mNKGMXJc0hwsztI4GuwNB7zMSp6d1YIIxqAoGhu7TFafJgtEy6zizSUtDym4 OvvLVANjll60Jx6jt3v1VN2Ku12LwLhhqKyg4mKgPARj05fP851T00epmC3KMs8ynhcn jhYg== X-Gm-Message-State: APjAAAWnHR2BXCf6u18yzQMhCN3GEThi/NiVU3cpDoIblAyIgPTzAUBB VVPYBlduzL3A81QfnFuG2Tg= X-Received: by 2002:a65:68c9:: with SMTP id k9mr68919329pgt.17.1564366137516; Sun, 28 Jul 2019 19:08:57 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:4:72:808::3ca]) by smtp.gmail.com with ESMTPSA id p15sm57011634pjf.27.2019.07.28.19.08.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jul 2019 19:08:56 -0700 (PDT) From: Jia-Ju Bai To: vkoul@kernel.org, dan.j.williams@intel.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Cc: dmaengine@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] dma: stm32-mdma: Fix a possible null-pointer dereference in stm32_mdma_irq_handler() Date: Mon, 29 Jul 2019 10:08:49 +0800 Message-Id: <20190729020849.17971-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In stm32_mdma_irq_handler(), chan is checked on line 1368. When chan is NULL, it is still used on line 1369: dev_err(chan2dev(chan), "MDMA channel not initialized\n"); Thus, a possible null-pointer dereference may occur. To fix this bug, "dev_dbg(mdma2dev(dmadev), ...)" is used instead. Signed-off-by: Jia-Ju Bai --- drivers/dma/stm32-mdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/stm32-mdma.c b/drivers/dma/stm32-mdma.c index d6e919d3936a..1311de74bfdd 100644 --- a/drivers/dma/stm32-mdma.c +++ b/drivers/dma/stm32-mdma.c @@ -1366,7 +1366,7 @@ static irqreturn_t stm32_mdma_irq_handler(int irq, void *devid) chan = &dmadev->chan[id]; if (!chan) { - dev_err(chan2dev(chan), "MDMA channel not initialized\n"); + dev_dbg(mdma2dev(dmadev), "MDMA channel not initialized\n"); goto exit; } -- 2.17.0