[PATCH linux dev-4.10 2/3] drivers: fsi: sbefifo: Fix memory leak

Eddie James eajames at linux.vnet.ibm.com
Wed Oct 18 08:35:52 AEDT 2017


From: "Edward A. James" <eajames at us.ibm.com>

Transfers weren't being cleaned up if they were complete but the user
never finished reading. This is very common.

Signed-off-by: Edward A. James <eajames at us.ibm.com>
---
 drivers/fsi/fsi-sbefifo.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index c914eaf..764d8f3 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -321,6 +321,11 @@ static void sbefifo_client_release(struct kref *kref)
 
 	if (!READ_ONCE(sbefifo->rc)) {
 		list_for_each_entry(xfr, &client->xfrs, client) {
+			if (test_bit(SBEFIFO_XFR_COMPLETE, &xfr->flags)) {
+				kfree(xfr);
+				continue;
+			}
+
 			/*
 			 * The client left with pending or running xfrs.
 			 * Cancel them.
-- 
1.8.3.1



More information about the openbmc mailing list