[sheepdog] [PATCH] sheep: return directly when sending data fails.

MORITA Kazutaka morita.kazutaka at gmail.com
Thu May 30 15:57:04 CEST 2013


At Thu, 30 May 2013 10:57:49 +0800,
王帆 wrote:
> 
> From 52e90e362e5413de4d424bc12102077402f6144f Mon Sep 17 00:00:00 2001
> From: wangfan <wangfan1985 at gmail.com>
> Date: Thu, 30 May 2013 10:22:46 +0800
> Subject: [PATCH] sheep: return directly when sending data fails.
> 
> when send data fails,do_client_rx will free struct client_info.
> call do_client_tx will access freed memory.
> 
> Signed-off-by: wangfan <wangfan1985 at gmail.com>
> ---
>  sheep/request.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/sheep/request.c b/sheep/request.c
> index e99f6f2..91e1f06 100644
> --- a/sheep/request.c
> +++ b/sheep/request.c
> @@ -613,12 +613,13 @@ static inline void finish_rx(struct client_info *ci)
>   queue_request(req);
>  }
> 
> -static void do_client_rx(struct client_info *ci)
> +static int do_client_rx(struct client_info *ci)
>  {
>   if (begin_rx(ci) < 0)
> - return;
> + return -1;
> 
>   finish_rx(ci);
> + return SD_RES_SUCCESS;

SD_RES_xxxx is a result code for SD_OP_xxxx.  We should return 0 here.

Thanks,

Kazutaka


More information about the sheepdog mailing list