backports for 4.5 (Re: [SCM] Samba Shared Repository - branch master updated)

Stefan Metzmacher metze at samba.org
Wed Aug 3 08:53:41 UTC 2016


Hi Amitay (and also others),

please remember to create bug reports (if possible before pushing to
master),
so that we can backport patches to 4.5 in time for the next rc.

I guess all those ctdb fixes should be backported...

Thanks!
metze

Am 03.08.2016 um 09:14 schrieb Amitay Isaacs:
> The branch, master has been updated
>        via  24e28c0 ctdb-mutex: Fix CID 1359217 Resource leak (RESOURCE_LEAK)
>        via  c6a7f68 ctdb-daemon: Fix CID 1363067 Resource leak (RESOURCE_LEAK)
>        via  74aca5f ctdb-daemon: Fix CID 1363233 Resource leak (RESOURCE_LEAK)
>        via  d46960f ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL)
>        via  aff33a5 ctdb-common: Consistently use strlcpy() on interface names
>        via  763f9c1 ctdb-common: Fix CID 1125553 Buffer not null terminated (BUFFER_SIZE_WARNING)
>       from  19ed816 ctdb-tests: Stop cross-talk between reclock tests
> 
> https://git.samba.org/?p=samba.git;a=shortlog;h=master
> 
> 
> - Log -----------------------------------------------------------------
> commit 24e28c0aa52399f03acf830a1ad72af0139b0606
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Thu Jul 28 14:04:23 2016 +1000
> 
>     ctdb-mutex: Fix CID 1359217 Resource leak (RESOURCE_LEAK)
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
>     
>     Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
>     Autobuild-Date(master): Wed Aug  3 09:13:55 CEST 2016 on sn-devel-144
> 
> commit c6a7f680ce74d4a630fa9305d0a926cc1a4b3d2c
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Thu Jul 28 12:06:23 2016 +1000
> 
>     ctdb-daemon: Fix CID 1363067 Resource leak (RESOURCE_LEAK)
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
> 
> commit 74aca5f4c671d9f15ae6c3a901978a1cf247dd6f
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Thu Jul 28 12:00:27 2016 +1000
> 
>     ctdb-daemon: Fix CID 1363233 Resource leak (RESOURCE_LEAK)
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
> 
> commit d46960f20e795cd4abc1c727705f77b2f0e0e564
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Wed Jul 27 17:43:34 2016 +1000
> 
>     ctdb-utils: Fix CID 1297451 Explicit null dereferenced (FORWARD_NULL)
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
> 
> commit aff33a59479cafcb1f24a07ff76383d47bb196b3
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Mon Aug 1 15:03:56 2016 +1000
> 
>     ctdb-common: Consistently use strlcpy() on interface names
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
> 
> commit 763f9c13f2998a8858e8a3ec013d166a3d429835
> Author: Martin Schwenke <martin at meltin.net>
> Date:   Wed Jul 27 16:22:36 2016 +1000
> 
>     ctdb-common: Fix CID 1125553 Buffer not null terminated (BUFFER_SIZE_WARNING)
>     
>     Signed-off-by: Martin Schwenke <martin at meltin.net>
>     Reviewed-by: Amitay Isaacs <amitay at gmail.com>
> 
> -----------------------------------------------------------------------
> 
> Summary of changes:
>  ctdb/common/system_linux.c            |  8 ++++----
>  ctdb/server/ctdb_mutex_fcntl_helper.c | 11 +++++++++--
>  ctdb/server/ctdb_recover.c            |  2 ++
>  ctdb/utils/ping_pong/ping_pong.c      |  4 +++-
>  4 files changed, 18 insertions(+), 7 deletions(-)
> 
> 
> Changeset truncated at 500 lines:
> 
> diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c
> index ef78df8..b66ce67 100644
> --- a/ctdb/common/system_linux.c
> +++ b/ctdb/common/system_linux.c
> @@ -116,7 +116,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
>  		}
>  
>  		/* get the mac address */
> -		strncpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name)-1);
> +		strlcpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name));
>  		ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
>  		if ( ret < 0 ) {
>  			close(s);
> @@ -202,7 +202,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
>  		}
>  
>  		DEBUG(DEBUG_DEBUG, (__location__ " Created SOCKET FD:%d for sending arp\n", s));
> -		strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
> +		strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
>  		if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
>  			DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
>  			close(s);
> @@ -210,7 +210,7 @@ int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
>  		}
>  
>  		/* get the mac address */
> -		strncpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name)-1);
> +		strlcpy(if_hwaddr.ifr_name, iface, sizeof(if_hwaddr.ifr_name));
>  		ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
>  		if ( ret < 0 ) {
>  			close(s);
> @@ -602,7 +602,7 @@ bool ctdb_sys_check_iface_exists(const char *iface)
>  		return true;
>  	}
>  
> -	strncpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name)-1);
> +	strlcpy(ifr.ifr_name, iface, sizeof(ifr.ifr_name));
>  	if (ioctl(s, SIOCGIFINDEX, &ifr) < 0 && errno == ENODEV) {
>  		DEBUG(DEBUG_CRIT,(__location__ " interface '%s' not found\n", iface));
>  		close(s);
> diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c
> index 93c7f62..06c2205 100644
> --- a/ctdb/server/ctdb_mutex_fcntl_helper.c
> +++ b/ctdb/server/ctdb_mutex_fcntl_helper.c
> @@ -27,7 +27,7 @@
>  
>  static char *progname = NULL;
>  
> -static char fcntl_lock(const char *file)
> +static char fcntl_lock(const char *file, int *outfd)
>  {
>  	int fd;
>  	struct flock lock;
> @@ -62,6 +62,8 @@ static char fcntl_lock(const char *file)
>  		return '3';
>  	}
>  
> +	*outfd = fd;
> +
>  	return '0';
>  }
>  
> @@ -70,6 +72,7 @@ int main(int argc, char *argv[])
>  	char result;
>  	int ppid;
>  	const char *file = NULL;
> +	int fd = -1;
>  
>  	progname = argv[0];
>  
> @@ -81,10 +84,14 @@ int main(int argc, char *argv[])
>  	ppid = getppid();
>  	file = argv[1];
>  
> -	result = fcntl_lock(file);
> +	result = fcntl_lock(file, &fd);
>  	sys_write(STDOUT_FILENO, &result, 1);
>  
>  	ctdb_wait_for_process_to_exit(ppid);
>  
> +	if (fd != -1) {
> +		close(fd);
> +	}
> +
>  	return 0;
>  }
> diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
> index 48f822c..6bed61c 100644
> --- a/ctdb/server/ctdb_recover.c
> +++ b/ctdb/server/ctdb_recover.c
> @@ -1299,6 +1299,7 @@ int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA inda
>  
>  		if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
>  			DEBUG(DEBUG_CRIT,(__location__ " bad ltdb record in indata\n"));
> +			talloc_free(records);
>  			return -1;
>  		}
>  
> @@ -1491,6 +1492,7 @@ int32_t ctdb_control_receive_records(struct ctdb_context *ctdb,
>  		if (data.dsize < sizeof(struct ctdb_ltdb_header)) {
>  			DEBUG(DEBUG_CRIT, (__location__ " bad ltdb record "
>  					   "in indata\n"));
> +			talloc_free(records);
>  			return -1;
>  		}
>  
> diff --git a/ctdb/utils/ping_pong/ping_pong.c b/ctdb/utils/ping_pong/ping_pong.c
> index be43a1d..f7f2eb1 100644
> --- a/ctdb/utils/ping_pong/ping_pong.c
> +++ b/ctdb/utils/ping_pong/ping_pong.c
> @@ -142,7 +142,9 @@ static void ping_pong(int fd, int num_locks)
>  	val = (unsigned char *)calloc(num_locks+1, sizeof(unsigned char));
>  	if (val == NULL) {
>  		printf("calloc failed\n");
> -		munmap(p, num_locks+1);
> +		if (use_mmap) {
> +			munmap(p, num_locks+1);
> +		}
>  		return;
>  	}
>  
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160803/62b4312d/signature.sig>


More information about the samba-technical mailing list