[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181220200002.29685-1-kjlu@umn.edu>
Date: Thu, 20 Dec 2018 14:00:01 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>,
Arnd Bergmann <arnd@...db.de>,
Dan Carpenter <dan.carpenter@...cle.com>,
Aymen Qader <qader.aymen@...il.com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] rts5208: fix a missing check of ms read
When ms_read_extra_data fails, the data read in "extra" buffer is
just incorrect and thus should be used. However, "extra" is used
in multiple places no matter ms_read_extra_data() fails or not.
The fix checks the status of ms_read_extra_data() and returns with
an error code upon its failure.
Signed-off-by: Kangjie Lu <kjlu@....edu>
---
drivers/staging/rts5208/ms.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index f53adf15c685..03b359ec69e6 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -1676,7 +1676,9 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk,
return STATUS_FAIL;
}
- ms_read_extra_data(chip, old_blk, i, extra, MS_EXTRA_SIZE);
+ retval = ms_read_extra_data(chip, old_blk, i, extra, MS_EXTRA_SIZE);
+ if (retval != STATUS_SUCCESS)
+ return STATUS_FAIL;
retval = ms_set_rw_reg_addr(chip, OverwriteFlag,
MS_EXTRA_SIZE, SystemParm, 6);
--
2.17.1
Powered by blists - more mailing lists