Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d23006f2 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

ipmi: fix use after free in _ipmi_destroy_user()



commit a92ce570c81dc0feaeb12a429b4bc65686d17967 upstream.

The intf_free() function frees the "intf" pointer so we cannot
dereference it again on the next line.

Fixes: cbb79863fc31 ("ipmi: Don't allow device module unload when in use")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Message-Id: <Y3M8xa1drZv4CToE@kili>
Cc: <stable@vger.kernel.org> # 5.5+
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cf19abbe
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1298,6 +1298,7 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
	unsigned long    flags;
	struct cmd_rcvr  *rcvr;
	struct cmd_rcvr  *rcvrs = NULL;
	struct module    *owner;

	if (!acquire_ipmi_user(user, &i)) {
		/*
@@ -1358,8 +1359,9 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
		kfree(rcvr);
	}

	owner = intf->owner;
	kref_put(&intf->refcount, intf_free);
	module_put(intf->owner);
	module_put(owner);
}

int ipmi_destroy_user(struct ipmi_user *user)