[PATCH] Make tdb record deletion circular-chain safe

Jeremy Allison jra at samba.org
Tue Nov 6 17:55:06 UTC 2018


On Sat, Nov 03, 2018 at 10:17:29AM +0100, Volker Lendecke wrote:
> On Mon, Oct 29, 2018 at 02:37:04PM -0700, Jeremy Allison via samba-technical wrote:
> > On Thu, Oct 25, 2018 at 09:12:44PM +0200, Volker Lendecke via samba-technical wrote:
> > and are comparing it to tdb->max_dead_records,
> > which is a uint32_t. However tdb->max_dead_records
> > is only ever initialized as follows:
> 
> I think it's the other way round. tdb_private.h has
> 
>         int max_dead_records;
> 
> which IMHO is wrong but not worth chainging our API for.
> 
> See the attached patch.

LGTM, RB+ and pushed !

> -- 
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de

> From deb54ede62b68d4f2a2bec8f25d302999a673f79 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Sat, 3 Nov 2018 10:11:26 +0100
> Subject: [PATCH] tdb: Align integer types
> 
> tdb->max_dead_records is "int", as is the corresponding parameter to
> tdb_set_max_dead(). Not that a signed variable makes any sense, but
> this is old code and tdb_set_max_dead() is a public API which we
> should not change for this.
> 
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
>  lib/tdb/common/freelist.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c
> index 90643862208..37a4c168533 100644
> --- a/lib/tdb/common/freelist.c
> +++ b/lib/tdb/common/freelist.c
> @@ -557,7 +557,7 @@ static bool tdb_alloc_dead(
>  
>  static void tdb_purge_dead(struct tdb_context *tdb, uint32_t hash)
>  {
> -	uint32_t max_dead_records = tdb->max_dead_records;
> +	int max_dead_records = tdb->max_dead_records;
>  
>  	tdb->max_dead_records = 0;
>  
> -- 
> 2.11.0
> 




More information about the samba-technical mailing list