From c66e99bf24bf07fdc3a601424512d332cc206f80 Mon Sep 17 00:00:00 2001 From: Wenhao Wang Date: Thu, 15 Jul 2021 22:12:08 -0700 Subject: [PATCH] trusty:storageproxyd: Fix return paths on errors The function send_ufs_rpmb_req is missing return paths on errors. This patch fixes it so that any UFS command failure will return error code to the function caller. Bug: 193855098 Test: Trusty storage tests Merged-In: I391ecff9ed3f892b7c3adae0ceeb18930791326f Change-Id: I391ecff9ed3f892b7c3adae0ceeb18930791326f --- trusty/storage/proxy/rpmb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/trusty/storage/proxy/rpmb.c b/trusty/storage/proxy/rpmb.c index d1ed6493f..abeacdfed 100644 --- a/trusty/storage/proxy/rpmb.c +++ b/trusty/storage/proxy/rpmb.c @@ -212,6 +212,7 @@ static int send_ufs_rpmb_req(int sg_fd, const struct storage_rpmb_send_req* req) rc = ioctl(sg_fd, SG_IO, &io_hdr); if (rc < 0) { ALOGE("%s: ufs ioctl failed: %d, %s\n", __func__, rc, strerror(errno)); + goto err_op; } write_buf += req->reliable_write_size; } @@ -225,6 +226,7 @@ static int send_ufs_rpmb_req(int sg_fd, const struct storage_rpmb_send_req* req) rc = ioctl(sg_fd, SG_IO, &io_hdr); if (rc < 0) { ALOGE("%s: ufs ioctl failed: %d, %s\n", __func__, rc, strerror(errno)); + goto err_op; } write_buf += req->write_size; } @@ -240,6 +242,8 @@ static int send_ufs_rpmb_req(int sg_fd, const struct storage_rpmb_send_req* req) ALOGE("%s: ufs ioctl failed: %d, %s\n", __func__, rc, strerror(errno)); } } + +err_op: return rc; }