LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH] ipvsadm: Fix svc->pe_name conditional

To: "Ryan O'Hara" <rohara@xxxxxxxxxx>
Subject: Re: [PATCH] ipvsadm: Fix svc->pe_name conditional
Cc: Simon Horman <horms@xxxxxxxxxxxx>, lvs-devel@xxxxxxxxxxxxxxx
From: Julian Anastasov <ja@xxxxxx>
Date: Mon, 19 Aug 2013 18:27:21 +0300 (EEST)
        Hello,

On Mon, 19 Aug 2013, Ryan O'Hara wrote:

> On Sun, Aug 18, 2013 at 09:13:39PM +0300, Julian Anastasov wrote:
> 
> > - CHECK_PE and CHECK_IPV4 as part of CHECK_COMPAT_SVC use
> > 'return' and we can leak svc in ipvs_get_service()
> >
> > - in ipvs_get_service() CHECK_PE does not need to be called,
> > it is already part of CHECK_COMPAT_SVC
> 
> Yes. I'm tempted to remove these macros due to the 'return'
> issue. Thoughts?

        May be they can use 'goto' instead of 'return':

        if (condition) {
                errno = XXX;
                goto out_err;
        }

        and funcs can have such exit point:

out_err:
        free stuff on error
        return ret;

> > - ipvs_get_service uses malloc but later calls CHECK_PE, may be
> > malloc should be changed with calloc
> 
> Aside from the fact that CHECK_PE could return without freeing memory,
> I don't see the problem here.

        malloc does not initialize the memory and checking of
svc->pe_name[0] in CHECK_PE would give random results.

Regards

--
Julian Anastasov <ja@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>