Bug 16217 - posix_eadb: use-after-free in push_xattr_blob_tdb_raw() when posix_eadb_add_list() fails
Summary: posix_eadb: use-after-free in push_xattr_blob_tdb_raw() when posix_eadb_add_l...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other (show other bugs)
Version: 4.24.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-08-10 07:16 UTC by Anoop C S
Modified: 2026-08-11 08:26 UTC (History)
1 user (show)

See Also:


Attachments
patch from master for v4-24-test (1.51 KB, patch)
2026-08-11 05:08 UTC, Anoop C S
dbagnall: review+
Details
patch from master for v4-23-test (1.51 KB, patch)
2026-08-11 05:09 UTC, Anoop C S
dbagnall: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anoop C S 2026-08-10 07:16:33 UTC
push_xattr_blob_tdb_raw() has a use-after-free on the error path when posix_eadb_add_list() fails. The error handler frees mem_ctx, then falls through via goto done where tdb_chainunlock() dereferences tkey.dptr - which was allocated under mem_ctx and is now freed and subsequently calls talloc_free(mem_ctx) again on the dangling pointer.

AddressSanitizer reports the failure as a use-after-free in tdb_chainunlock(). posix_eadb_add_list() can fail due to database, I/O, or disk-full errors, so this is reachable in production.
Comment 1 Samba QA Contact 2026-08-10 18:08:03 UTC
This bug was referenced in samba master:

e595f37ccfec93f54d39140785643197ed09a9a4
Comment 2 Anoop C S 2026-08-11 05:08:48 UTC
Created attachment 19159 [details]
patch from master for v4-24-test
Comment 3 Anoop C S 2026-08-11 05:09:16 UTC
Created attachment 19160 [details]
patch from master for v4-23-test
Comment 4 Douglas Bagnall 2026-08-11 08:26:48 UTC
actually, let's not bother with a ntvfs backport.