All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
@ 2010-09-10  2:16 Tristan Ye
  2010-09-10  2:19 ` Sunil Mushran
  2010-09-10 16:22 ` Joel Becker
  0 siblings, 2 replies; 4+ messages in thread
From: Tristan Ye @ 2010-09-10  2:16 UTC (permalink / raw)
  To: ocfs2-devel

This patch tries to handle the case in which list 'dlm->tracking_list' is
empty, to avoid accessing an invalid pointer. It fixes the following oops:

http://oss.oracle.com/bugzilla/show_bug.cgi?id=1287

Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
---
 fs/ocfs2/dlm/dlmdebug.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 5efdd37..901ca52 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
 	spin_lock(&dlm->track_lock);
 	if (oldres)
 		track_list = &oldres->tracking;
-	else
+	else {
 		track_list = &dlm->tracking_list;
+		if (list_empty(track_list)) {
+			dl = NULL;
+			spin_unlock(&dlm->track_lock);
+			goto bail;
+		}
+	}
 
 	list_for_each_entry(res, track_list, tracking) {
 		if (&res->tracking == &dlm->tracking_list)
@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
 	} else
 		dl = NULL;
 
+bail:
 	/* passed to seq_show */
 	return dl;
 }
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
  2010-09-10  2:16 [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c Tristan Ye
@ 2010-09-10  2:19 ` Sunil Mushran
  2010-09-10  2:31   ` tristan
  2010-09-10 16:22 ` Joel Becker
  1 sibling, 1 reply; 4+ messages in thread
From: Sunil Mushran @ 2010-09-10  2:19 UTC (permalink / raw)
  To: ocfs2-devel

Signed-off-by: Sunil Mushran<sunil.mushran@oracle.com>

I am assuming you have tested it. ;)


On 09/09/2010 07:16 PM, Tristan Ye wrote:
> This patch tries to handle the case in which list 'dlm->tracking_list' is
> empty, to avoid accessing an invalid pointer. It fixes the following oops:
>
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1287
>
> Signed-off-by: Tristan Ye<tristan.ye@oracle.com>
> ---
>   fs/ocfs2/dlm/dlmdebug.c |    9 ++++++++-
>   1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
> index 5efdd37..901ca52 100644
> --- a/fs/ocfs2/dlm/dlmdebug.c
> +++ b/fs/ocfs2/dlm/dlmdebug.c
> @@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
>   	spin_lock(&dlm->track_lock);
>   	if (oldres)
>   		track_list =&oldres->tracking;
> -	else
> +	else {
>   		track_list =&dlm->tracking_list;
> +		if (list_empty(track_list)) {
> +			dl = NULL;
> +			spin_unlock(&dlm->track_lock);
> +			goto bail;
> +		}
> +	}
>
>   	list_for_each_entry(res, track_list, tracking) {
>   		if (&res->tracking ==&dlm->tracking_list)
> @@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
>   	} else
>   		dl = NULL;
>
> +bail:
>   	/* passed to seq_show */
>   	return dl;
>   }
>    

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
  2010-09-10  2:19 ` Sunil Mushran
@ 2010-09-10  2:31   ` tristan
  0 siblings, 0 replies; 4+ messages in thread
From: tristan @ 2010-09-10  2:31 UTC (permalink / raw)
  To: ocfs2-devel

Sunil Mushran wrote:
> Signed-off-by: Sunil Mushran<sunil.mushran@oracle.com>
>
> I am assuming you have tested it. ;)

Sure, both in local mode by creating a user dlm domain, and in a cluster.

>
>
> On 09/09/2010 07:16 PM, Tristan Ye wrote:
>> This patch tries to handle the case in which list 
>> 'dlm->tracking_list' is
>> empty, to avoid accessing an invalid pointer. It fixes the following 
>> oops:
>>
>> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1287
>>
>> Signed-off-by: Tristan Ye<tristan.ye@oracle.com>
>> ---
>>   fs/ocfs2/dlm/dlmdebug.c |    9 ++++++++-
>>   1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
>> index 5efdd37..901ca52 100644
>> --- a/fs/ocfs2/dlm/dlmdebug.c
>> +++ b/fs/ocfs2/dlm/dlmdebug.c
>> @@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file 
>> *m, loff_t *pos)
>>       spin_lock(&dlm->track_lock);
>>       if (oldres)
>>           track_list =&oldres->tracking;
>> -    else
>> +    else {
>>           track_list =&dlm->tracking_list;
>> +        if (list_empty(track_list)) {
>> +            dl = NULL;
>> +            spin_unlock(&dlm->track_lock);
>> +            goto bail;
>> +        }
>> +    }
>>
>>       list_for_each_entry(res, track_list, tracking) {
>>           if (&res->tracking ==&dlm->tracking_list)
>> @@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file 
>> *m, loff_t *pos)
>>       } else
>>           dl = NULL;
>>
>> +bail:
>>       /* passed to seq_show */
>>       return dl;
>>   }
>>    
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c
  2010-09-10  2:16 [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c Tristan Ye
  2010-09-10  2:19 ` Sunil Mushran
@ 2010-09-10 16:22 ` Joel Becker
  1 sibling, 0 replies; 4+ messages in thread
From: Joel Becker @ 2010-09-10 16:22 UTC (permalink / raw)
  To: ocfs2-devel

On Fri, Sep 10, 2010 at 10:16:33AM +0800, Tristan Ye wrote:
> This patch tries to handle the case in which list 'dlm->tracking_list' is
> empty, to avoid accessing an invalid pointer. It fixes the following oops:
> 
> http://oss.oracle.com/bugzilla/show_bug.cgi?id=1287
> 
> Signed-off-by: Tristan Ye <tristan.ye@oracle.com>

	This patch is now in the fixes branch of ocfs2.git.

Joel

-- 

"The first requisite of a good citizen in this republic of ours
 is that he shall be able and willing to pull his weight."
	- Theodore Roosevelt

Joel Becker
Consulting Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-10 16:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10  2:16 [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle empty list in lockres_seq_start() for dlmdebug.c Tristan Ye
2010-09-10  2:19 ` Sunil Mushran
2010-09-10  2:31   ` tristan
2010-09-10 16:22 ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.