The Samba-Bugzilla – Attachment 13884 Details for
Bug 13195
g_lock conflict detection broken when processing stale entries.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Backport for v4-6-test
tmp46.diff.txt (text/plain), 1.69 KB, created by
Stefan Metzmacher
on 2017-12-21 21:18:44 UTC
(
hide
)
Description:
Backport for v4-6-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2017-12-21 21:18:44 UTC
Size:
1.69 KB
patch
obsolete
>From 11d8c8e587b4f00b08b34cccba3aac36817d0125 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 20 Dec 2017 08:25:19 +0100 >Subject: [PATCH] g_lock: fix cleanup of stale entries in g_lock_trylock() > >g_lock_trylock() always incremented the counter 'i', even after cleaning a stale >entry at position 'i', which means it skipped checking for a conflict against >the new entry at position 'i'. > >As result a process could get a write lock, while there're still >some read lock holders. Once we get into that problem, also more than >one write lock are possible. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Volker Lendecke <vl@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Wed Dec 20 20:31:48 CET 2017 on sn-devel-144 >(similar to commit 576fb4fb5dc506bf55e5cf87973999dca444149b) >--- > source3/lib/g_lock.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > >diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c >index f954978..6a661cd 100644 >--- a/source3/lib/g_lock.c >+++ b/source3/lib/g_lock.c >@@ -133,7 +133,9 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self, > return NT_STATUS_INTERNAL_ERROR; > } > >- for (i=0; i<num_locks; i++) { >+ i=0; >+ >+ while (i < num_locks) { > if (serverid_equal(&self, &locks[i].pid)) { > status = NT_STATUS_INTERNAL_ERROR; > goto done; >@@ -160,7 +162,9 @@ static NTSTATUS g_lock_trylock(struct db_record *rec, struct server_id self, > locks[i] = locks[num_locks-1]; > num_locks -= 1; > modified = true; >+ continue; > } >+ i++; > } > > tmp = talloc_realloc(talloc_tos(), locks, struct g_lock_rec, >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
vl
:
review+
Actions:
View
Attachments on
bug 13195
:
13881
|
13882
|
13883
| 13884 |
14421