From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 3/6] cnic: Fix panic in cnic_iscsi_nl_msg_recv() when device is down.
Date: Wed, 24 Feb 2010 16:42:06 -0800 [thread overview]
Message-ID: <1267058529-18454-3-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1267058529-18454-2-git-send-email-mchan@broadcom.com>
Some data structures are freed when the device is down and it will
crash if an ISCSI netlink message is received. Add RCU protection
to prevent this. In the shutdown path, ulp_ops[CNIC_ULP_L4] is
assigned NULL and rcu_synchronized before freeing the data
structures.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/cnic.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 40865aa..4558444 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -327,6 +327,12 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
if (l5_cid >= MAX_CM_SK_TBL_SZ)
break;
+ rcu_read_lock();
+ if (!rcu_dereference(cp->ulp_ops[CNIC_ULP_L4])) {
+ rc = -ENODEV;
+ rcu_read_unlock();
+ break;
+ }
csk = &cp->csk_tbl[l5_cid];
csk_hold(csk);
if (cnic_in_use(csk)) {
@@ -341,6 +347,7 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type,
cnic_cm_set_pg(csk);
}
csk_put(csk);
+ rcu_read_unlock();
rc = 0;
}
}
--
1.6.4.GIT
next prev parent reply other threads:[~2010-02-25 0:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 0:42 [PATCH net-next 1/6] cnic: Finetune iSCSI connection set up Michael Chan
2010-02-25 0:42 ` [PATCH net-next 2/6] cnic: Finetune iSCSI connection reset Michael Chan
2010-02-25 0:42 ` Michael Chan [this message]
2010-02-25 0:42 ` [PATCH net-next 4/6] cnic: Simplify route checking during iSCSI connection Michael Chan
2010-02-25 0:42 ` [PATCH net-next 5/6] cnic: Use union for the status blocks of different devices Michael Chan
2010-02-25 0:42 ` [PATCH net-next 6/6] cnic: Update version to 2.1.1 Michael Chan
2010-02-26 10:11 ` David Miller
2010-02-26 10:11 ` [PATCH net-next 5/6] cnic: Use union for the status blocks of different devices David Miller
2010-02-26 10:11 ` [PATCH net-next 4/6] cnic: Simplify route checking during iSCSI connection David Miller
2010-02-26 0:51 ` [PATCH net-next 3/6] cnic: Fix panic in cnic_iscsi_nl_msg_recv() when device is down Simon Horman
2010-02-26 7:01 ` Michael Chan
2010-02-26 18:40 ` Paul E. McKenney
2010-02-26 19:11 ` Michael Chan
2010-02-26 19:33 ` Paul E. McKenney
2010-02-26 10:11 ` David Miller
2010-02-26 10:11 ` [PATCH net-next 2/6] cnic: Finetune iSCSI connection reset David Miller
2010-02-26 10:11 ` [PATCH net-next 1/6] cnic: Finetune iSCSI connection set up David Miller
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=1267058529-18454-3-git-send-email-mchan@broadcom.com \
--to=mchan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).