]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
FFS extattr: fix handling of the tail
authorKonstantin Belousov <kib@FreeBSD.org>
Mon, 1 Mar 2021 15:24:11 +0000 (17:24 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 2 Mar 2021 00:19:34 +0000 (02:19 +0200)
commit8742817ba62ec604156c139727155d36f5fbad06
treea54c3515730116784458352de676961f44478e0b
parenta59e2982fe3e6339629cc77fe9d349d60e03a05e
FFS extattr: fix handling of the tail

There are three issues with change that stopped truncating ea area before
write, and resulted in possible zero tail in the ea area:
- Truncate to zero checked i_ea_len after the reference was dropped,
  making the last drop effectively truncate to zero length always.
- Loop to fill uio for zeroing specified too large length, that triggered
  assert in normal situation.
- Integrity check could trip over the tail, instead we must allow
  partial header or header with zero length, and clamp ea image in
  memory at it.

Reported by: arichardson
Tested by: arichardson, pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Fixup: 5e198e7646a27412c0541719f7bf1bbc0bd89223
Differential Revision: https://reviews.freebsd.org/D28999
sys/ufs/ffs/ffs_vnops.c