Re: [PATCH 4/5] FIX: Validate input in ping_monitor function

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

 



On Mon, 24 Jan 2011 15:17:29 +0100
Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx> wrote:

> For native case we do not have monitor running so we have to
> return without pinging.
> Moreover we have NULL as input parameter. We should to avoid
> segmentation fault.

I have not applied this patch or the next one.
I would rather not call ping_XXX when not needed, rather than have it
check if it was needed or not.

NeilBrown

> 
> Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
> ---
>  msg.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/msg.c b/msg.c
> index 76e74e7..b97ebec 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -206,8 +206,13 @@ int fping_monitor(int sfd)
>  /* give the monitor a chance to update the metadata */
>  int ping_monitor(char *devname)
>  {
> -	int sfd = connect_monitor(devname);
> -	int err = fping_monitor(sfd);
> +	int sfd, err;
> +
> +	if (!devname)
> +		return -1;
> +
> +	sfd = connect_monitor(devname);
> +	err = fping_monitor(sfd);
>  
>  	close(sfd);
>  	return err;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid"
> in the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux