From: Alexander Beregalov <a.beregalov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Alexander Beregalov <a.beregalov@gmail.com>,
James Bottomley <James.Bottomley@suse.de>
Subject: [PATCH 2/4] SCSI: pm8001: avoid NULL pointer dereference
Date: Thu, 7 Jan 2010 04:48:39 +0300 [thread overview]
Message-ID: <1262828921-29517-2-git-send-email-a.beregalov@gmail.com> (raw)
In-Reply-To: <1262828921-29517-1-git-send-email-a.beregalov@gmail.com>
Assign device_id only if pm8001_dev is not NULL.
Cc: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
---
drivers/scsi/pm8001/pm8001_sas.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index 7f9c83a..4e748d1 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -884,11 +884,12 @@ static void pm8001_dev_gone_notify(struct domain_device *dev)
u32 tag;
struct pm8001_hba_info *pm8001_ha;
struct pm8001_device *pm8001_dev = dev->lldd_dev;
- u32 device_id = pm8001_dev->device_id;
+ u32 device_id;
pm8001_ha = pm8001_find_ha_by_dev(dev);
spin_lock_irqsave(&pm8001_ha->lock, flags);
pm8001_tag_alloc(pm8001_ha, &tag);
if (pm8001_dev) {
+ device_id = pm8001_dev->device_id;
PM8001_DISC_DBG(pm8001_ha,
pm8001_printk("found dev[%d:%x] is gone.\n",
pm8001_dev->device_id, pm8001_dev->dev_type));
--
1.6.6
next prev parent reply other threads:[~2010-01-07 1:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-07 1:48 [PATCH 1/4] mtd: mxc_nand: " Alexander Beregalov
2010-01-07 1:48 ` Alexander Beregalov [this message]
2010-01-07 1:48 ` [PATCH 3/4] ISDN: hysdn: " Alexander Beregalov
2010-01-07 1:48 ` [PATCH 4/4] uml: line.c: " Alexander Beregalov
2010-01-07 4:32 ` Jeff Dike
2010-01-07 15:56 ` Alexander Beregalov
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=1262828921-29517-2-git-send-email-a.beregalov@gmail.com \
--to=a.beregalov@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®