From 04eeef1e27efd3d5b9ef3d44f67ddc4a5fdfa028 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 31 Aug 2022 13:27:30 -0400 Subject: [PATCH] Fix chunking of ACL reads. (#22267) The chunking mechanism relies on errors being propagated as-is from the encoder to the caller of AttributeAccessInterface::Read. So we don't want to do any error mapping on the read errors, unlike write errors. --- .../access-control-server/access-control-server.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/clusters/access-control-server/access-control-server.cpp b/src/app/clusters/access-control-server/access-control-server.cpp index 988f082c8c7cf2..3e3122390c8abb 100644 --- a/src/app/clusters/access-control-server/access-control-server.cpp +++ b/src/app/clusters/access-control-server/access-control-server.cpp @@ -461,7 +461,11 @@ CHIP_ERROR ChipErrorToImErrorMap(CHIP_ERROR err) CHIP_ERROR AccessControlAttribute::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) { - return ChipErrorToImErrorMap(ReadImpl(aPath, aEncoder)); + // Note: We are not generating any errors under ReadImpl ourselves; it's + // just the IM encoding machinery that does it. And we should propagate + // those errors through as-is, without mapping them to other errors, because + // they are used to communicate various state within said enoding machinery. + return ReadImpl(aPath, aEncoder); } CHIP_ERROR AccessControlAttribute::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)