[PATCH] Revert "kernel/relay.c: fix potential memory leak"
From: Eric Biggers
Date: Fri Jan 26 2018 - 19:49:32 EST
From: Eric Biggers <ebiggers@xxxxxxxxxx>
This reverts commit ba62bafe942b159a6109cbec780d36496e06b6c5.
This commit introduced a double free bug, because 'chan' is already
freed by the line:
kref_put(&chan->kref, relay_destroy_channel);
This bug was found by syzkaller, using the BLKTRACESETUP ioctl.
Fixes: ba62bafe942b ("kernel/relay.c: fix potential memory leak")
Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # v4.7+
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
kernel/relay.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/relay.c b/kernel/relay.c
index 39a9dfc69486..55da824f4adc 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -611,7 +611,6 @@ struct rchan *relay_open(const char *base_filename,
kref_put(&chan->kref, relay_destroy_channel);
mutex_unlock(&relay_channels_mutex);
- kfree(chan);
return NULL;
}
EXPORT_SYMBOL_GPL(relay_open);
--
2.16.0.rc1.238.g530d649a79-goog