Skip to content

Commit

Permalink
Fix removal of SA in sa_modify_attrs()
Browse files Browse the repository at this point in the history
The sa_modify_attrs() function can add, remove or replace an SA.
The main loop in the function uses the index "i" to iterate over the
existing SAs and uses the index "j" for writing them into a new buffer
bia SA_ADD_BULK_ATTR().  The write index, "j" is incremented on remove
(SA_REMOVE) operations which leads to a corruption in the new SA buffer.
This patch remove the increment for SA_REMOVE operations.
  • Loading branch information
dweeezil committed Oct 19, 2014
1 parent f178ade commit c53847e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions module/zfs/sa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,10 +1747,8 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
if (attr == newattr) {
if (length == 0)
++length_idx;
if (action == SA_REMOVE) {
j++;
if (action == SA_REMOVE)
continue;
}
ASSERT(length == 0);
ASSERT(action == SA_REPLACE);
SA_ADD_BULK_ATTR(attr_desc, j, attr,
Expand Down

0 comments on commit c53847e

Please sign in to comment.