From: Cong Ding <dinggnu@gmail.com>
To: Wolfram Sang <w.sang@pengutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Karol Lewandowski <k.lewandowsk@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Haojian Zhuang <haojian.zhuang@marvell.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Cong Ding <dinggnu@gmail.com>
Subject: [PATCH] i2c: busses/i2c-pxa.c: fix potential null pointer dereference error
Date: Mon, 4 Feb 2013 23:11:36 +0100 [thread overview]
Message-ID: <1360015899-13706-1-git-send-email-dinggnu@gmail.com> (raw)
If it goes to eclk through line 1107, the variable res would be NULL. It will
cause a null pointer dereference error if we call release_mem_region.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
drivers/i2c/busses/i2c-pxa.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 1034d93..eadf1a4 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1211,7 +1211,8 @@ eremap:
eclk:
kfree(i2c);
emalloc:
- release_mem_region(res->start, resource_size(res));
+ if (!res)
+ release_mem_region(res->start, resource_size(res));
return ret;
}
--
1.7.9.5
next reply other threads:[~2013-02-04 22:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 22:11 Cong Ding [this message]
2013-02-04 23:47 ` [PATCH] i2c: busses/i2c-pxa.c: fix potential null pointer dereference error Kyungmin Park
2013-02-05 0:03 ` Cong Ding
2013-02-05 0:05 ` [PATCH v2] " Cong Ding
2013-02-05 1:14 ` Haojian Zhuang
2013-02-05 10:25 ` Cong Ding
2013-02-05 11:27 ` Haojian Zhuang
2013-02-14 11:28 ` [PATCH v3] " Cong Ding
2013-02-14 16:10 ` Haojian Zhuang
2013-03-21 10:54 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360015899-13706-1-git-send-email-dinggnu@gmail.com \
--to=dinggnu@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=haojian.zhuang@marvell.com \
--cc=k.lewandowsk@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=w.sang@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox