[Sheepdog] [PATCH] fixed a bug of reading length which may cause core dump.

Liu Yuan namei.unix at gmail.com
Fri Apr 6 12:20:05 CEST 2012


On 04/06/2012 06:15 PM, Li Wenpeng wrote:

> From: levin li <xingke.lwp at taobao.com>
> 
> in farm_link(), when we try to put the object from the trunk
> to the object directory, we specified a const length SD_DATA_OBJ_SIZE,
> but the object we try to put may has a different length, which may
> cause core dump in some case.
> 
> Signed-off-by: levin li <xingke.lwp at taobao.com>
> ---
>  sheep/farm/farm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
> index bb84ce6..e502462 100644
> --- a/sheep/farm/farm.c
> +++ b/sheep/farm/farm.c
> @@ -507,7 +507,7 @@ static int farm_link(uint64_t oid, struct siocb *iocb, int tgt_epoch)
>  	if (!buf)
>  		goto out;
>  
> -	io.length = SD_DATA_OBJ_SIZE;
> +	io.length = iocb->length;
>  	io.buf = buf;
>  	ret = farm_atomic_put(oid, &io);
>  out:


Applied, thanks.

Yuan



More information about the sheepdog mailing list