From: Amit Kumar Salecha <amit.salecha@qlogic.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, dhananjay.phadke@qlogic.com,
ameen.rahman@qlogic.com
Subject: [PATCH NEXT 4/7] qlcnic: protect resoruce cleanup by rtnl lock
Date: Mon, 1 Feb 2010 06:30:41 -0800 [thread overview]
Message-ID: <1265034644-19461-5-git-send-email-amit.salecha@qlogic.com> (raw)
In-Reply-To: <1265034644-19461-1-git-send-email-amit.salecha@qlogic.com>
o context resources can be in used, while resoruce cleanup is in progress,
during fw recover.
o Null pointer execption can occur in send_cmd_desc, if fw recovery
module frees tx ring without rtnl lock.
o Same applies to ethtool register dump and FW health registers should be dump
in any case.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic_ethtool.c | 6 +++---
drivers/net/qlcnic/qlcnic_main.c | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 65e9620..37df5f6 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -326,12 +326,12 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
(adapter->pdev)->device;
- if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC)
- return;
-
for (i = 0; diag_registers[i] != -1; i++)
regs_buff[i] = QLCRD32(adapter, diag_registers[i]);
+ if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC)
+ return;
+
regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/
regs_buff[i++] = 1; /* No. of tx ring */
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 9a98285..7259adc 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -2051,7 +2051,9 @@ qlcnic_detach_work(struct work_struct *work)
qlcnic_down(adapter, netdev);
+ rtnl_lock();
qlcnic_detach(adapter);
+ rtnl_unlock();
status = QLCRD32(adapter, QLCNIC_PEG_HALT_STATUS1);
--
1.6.0.2
next prev parent reply other threads:[~2010-02-01 14:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-01 14:30 [PATCH NEXT 0/7]qlcnic: add diagnostic tests Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 1/7] qlcnic: use DEFINE_PCI_DEVICE_TABLE Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 2/7] qlcnic: add ethernet identifier in board info Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 3/7] qlcnic: clear device reset state after fw recovery Amit Kumar Salecha
2010-02-01 14:30 ` Amit Kumar Salecha [this message]
2010-02-01 14:30 ` [PATCH NEXT 5/7] qlcnic: add LED diagnostic test Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 6/7] qlcnic: add interrupt " Amit Kumar Salecha
2010-02-01 14:30 ` [PATCH NEXT 7/7] qlcnic: add loppback " Amit Kumar Salecha
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=1265034644-19461-5-git-send-email-amit.salecha@qlogic.com \
--to=amit.salecha@qlogic.com \
--cc=ameen.rahman@qlogic.com \
--cc=davem@davemloft.net \
--cc=dhananjay.phadke@qlogic.com \
--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