From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 18/18] ocfs2: Fix NULL pointer dereferences in o2net
Date: Tue Mar 11 16:32:25 2008 [thread overview]
Message-ID: <1205278329-11111-19-git-send-email-sunil.mushran@oracle.com> (raw)
In-Reply-To: <1205278329-11111-1-git-send-email-sunil.mushran@oracle.com>
Mainline commit cdef59a94c2fc962ada379d4240d556db7b56d55
Author: Tao Ma <tao.ma@oracle.com>
Date: Wed, 5 Mar 2008 15:49:55 +0800
In some situations, ocfs2_set_nn_state might get called with sc = NULL and
valid = 0. If sc = NULL, we can't dereference it to get the o2nm_node
member. Instead, do what o2net_initialize_handshake does and use NULL when
calling o2net_reconnect_delay and o2net_idle_timeout.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
---
fs/ocfs2/cluster/tcp.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 6dbdee0..090018a 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -451,9 +451,9 @@ static void o2net_set_nn_state(struct o2net_node *nn,
/* delay if we're withing a RECONNECT_DELAY of the
* last attempt */
delay = (nn->nn_last_connect_attempt +
- msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node)))
+ msecs_to_jiffies(o2net_reconnect_delay(NULL)))
- jiffies;
- if (delay > msecs_to_jiffies(o2net_reconnect_delay(sc->sc_node)))
+ if (delay > msecs_to_jiffies(o2net_reconnect_delay(NULL)))
delay = 0;
mlog(ML_CONN, "queueing conn attempt in %lu jiffies\n", delay);
queue_delayed_work(o2net_wq, &nn->nn_connect_work, delay);
@@ -1583,12 +1583,11 @@ static void o2net_connect_expired(kapi_work_struct_t *work)
spin_lock(&nn->nn_lock);
if (!nn->nn_sc_valid) {
- struct o2nm_node *node = nn->nn_sc->sc_node;
mlog(ML_ERROR, "no connection established with node %u after "
"%u.%u seconds, giving up and returning errors.\n",
o2net_num_from_nn(nn),
- o2net_idle_timeout(node) / 1000,
- o2net_idle_timeout(node) % 1000);
+ o2net_idle_timeout(NULL) / 1000,
+ o2net_idle_timeout(NULL) % 1000);
o2net_set_nn_state(nn, NULL, 0, -ENOTCONN);
}
--
1.5.3.4
next prev parent reply other threads:[~2008-03-11 16:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-11 16:32 [Ocfs2-devel] Backports to OCFS2 1.4 Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 08/18] ocfs2: Correct use of ! and & in aops.c Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 07/18] ocfs2: make dlm_do_assert_master() static Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 01/18] ocfs2: Add helper task_pid_nr Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 05/18] ocfs2: possible cleanups Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 06/18] ocfs2: make ocfs2_downconvert_thread() static Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 04/18] ocfs2: Fix writeout in ocfs2_data_convert_worker() Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 02/18] ocfs2: Spelling fixes Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 11/18] ocfs2: Fix endian bug in o2dlm protocol negotiation Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 14/18] ocfs2/dlm: Add missing dlm_lockres_put()s in migration path Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 15/18] ocfs2/dlm: Add missing dlm_lockres_put()s Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 16/18] ocfs2/dlm: Print message showing the recovery master Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 12/18] ocfs2: Fix an endian bug in online resize Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 03/18] ocfs2: Negotiate locking protocol versions Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 09/18] ocfs2/dlm: fix printk warning Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 10/18] ocfs2: Use dlm_print_one_lock_resource for lock resource print Sunil Mushran
2008-03-11 16:32 ` Sunil Mushran [this message]
2008-03-16 21:10 ` [Ocfs2-devel] how to use run_lvb_torture.py ? Coly Li
2008-03-17 5:09 ` Marcos E. Matsunaga
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 17/18] ocfs2/dlm: dlm_thread should not sleep while holding the dlm_spinlock Sunil Mushran
2008-03-11 16:32 ` [Ocfs2-devel] [PATCH 13/18] ocfs2/dlm: Add missing dlm_lock_put()s Sunil Mushran
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=1205278329-11111-19-git-send-email-sunil.mushran@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.com \
/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).