Subject: Re: [PATCH] sctp: kzalloc() error handling on deleting last address

From: Wei Yongjun <[email-masked]>
Date: Fri, 10 Jun 2011 16:21:51 +0800

> From 49a66ecad72af8c367b125c695a113d3f3870320 Mon Sep 17 00:00:00 2001
> From: Michio Honda <[email-masked]>
> Date: Fri, 10 Jun 2011 16:42:14 +0900
> Subject: [PATCH] sctp: kzalloc() error handling on deleting last address
>
> Signed-off-by: Michio Honda <[email-masked]>
> ---
>  net/sctp/socket.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index e7e1b14..a23d898 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -786,6 +786,8 @@ static int sctp_send_asconf_del_ip(struct sock		*sk,
>  				continue;
>  			asoc->asconf_addr_del_pending =
>  			    kzalloc(sizeof(union sctp_addr), GFP_ATOMIC);
> +			if (asoc->asconf_addr_del_pending == NULL) 
> +				continue;

better to return with ENOMEM.

if (asoc->asconf_addr_del_pending == NULL) {
	retval = -ENOMEM;
	goto out;
}

>  			asoc->asconf_addr_del_pending->sa.sa_family =
>  				    addrs->sa_family;
>  			asoc->asconf_addr_del_pending->v4.sin_port =