Bug 690526
| Summary: | Double free in dse_add() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Retired] 389 | Reporter: | Nathan Kinder <nkinder> | ||||
| Component: | Directory Server | Assignee: | Nathan Kinder <nkinder> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Viktor Ashirov <vashirov> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 1.2.8 | CC: | amsharma, rmeggins | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | |||||||
| : | 690536 (view as bug list) | Environment: | |||||
| Last Closed: | 2015-12-07 17:00:39 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 639035, 656390, 690536 | ||||||
| Attachments: |
|
||||||
Created attachment 487370 [details]
Patch for cov#10734
Do we need to get this in asap? (In reply to comment #2) > Do we need to get this in asap? I don't know how easy it is to trigger this issue since it is in an error block when adding an entry to the dse backend, but it seems like we should try to get it in ASAP to me. Pushed to master. Thanks to Rich for his review! Counting objects: 11, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 1.02 KiB, done. Total 6 (delta 4), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git b41338f..1b22679 master -> master Pushed to 389-ds-base-1.2.8 branch: Counting objects: 11, done. Delta compression using up to 2 threads. Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 1.02 KiB, done. Total 6 (delta 4), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git e641e98..753c550 128-local -> 389-ds-base-1.2.8 Rich has confirmed the issue is fixed. |
It's possible to encounter a double free of a Slapi_Entry in an error condition in dse_add(). This function makes a copy of the entry being added for use by postop plug-ins, but it can be free'd twice in the following code: e_copy = slapi_entry_dup(e); if ( dse_add_entry_pb(pdse, e_copy, pb) != 0) { slapi_send_ldap_result( pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL ); slapi_sdn_done(&sdn); return dse_add_return(error, e_copy); } The dse_add_entry_pb() function frees the passed in entry in all conditions, but dse_add_return() also free's the passed in entry. This double free could trigger a crash. The way dse_add works is that entry in SLAPI_ADD_ENTRY in the pblock should be consumed upon success, but will be left for the caller to deal with upon failure. We should be passing NULL for the second argument to dse_add_return() to avoid the double free.