Re: [patch] sock_diag: off by one checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/08/2011 10:49 AM, Dan Carpenter wrote:
> These tests are off by one because sock_diag_handlers[] only has AF_MAX
> elements.

Oops :(

> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Acked-by: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>

> diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c
> index fbaf01c..9c27bcd 100644
> --- a/net/core/sock_diag.c
> +++ b/net/core/sock_diag.c
> @@ -32,7 +32,7 @@ int sock_diag_register(struct sock_diag_handler *hndl)
>  {
>  	int err = 0;
>  
> -	if (hndl->family > AF_MAX)
> +	if (hndl->family >= AF_MAX)
>  		return -EINVAL;
>  
>  	mutex_lock(&sock_diag_table_mutex);
> @@ -50,7 +50,7 @@ void sock_diag_unregister(struct sock_diag_handler *hnld)
>  {
>  	int family = hnld->family;
>  
> -	if (family > AF_MAX)
> +	if (family >= AF_MAX)
>  		return;
>  
>  	mutex_lock(&sock_diag_table_mutex);
> 

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux