[Crash-utility] [PATCH] Report error for NULL list_head pointers

Dave Anderson anderson at redhat.com
Thu Mar 30 19:13:27 UTC 2017



----- Original Message -----
> From: Rabin Vincent <rabinv at axis.com>
> 
> If we hit a NULL next pointer on a struct list_head list it means the
> list is corrupted.

Yeah, that is true -- although it's always been this way and there's never
been a bug report.  I'm curious as to what happened in your case where
you discovered this? 

Dave


> ---
>  tools.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools.c b/tools.c
> index 8190d7e..577820d 100644
> --- a/tools.c
> +++ b/tools.c
> @@ -3808,6 +3808,12 @@ do_list(struct list_data *ld)
>  		}
>  
>  		if (next == 0) {
> +			if (ld->flags & LIST_HEAD_FORMAT) {
> +				error(INFO, "\ninvalid list entry: 0\n");
> +				if (close_hq_on_return)
> +					hq_close();
> +				return -1;
> +			}
>  			if (CRASHDEBUG(1))
>  				console("do_list end: next:%lx\n", next);
>  			break;
> --
> 2.7.0


 




More information about the Crash-utility mailing list