LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Young Xiao <92siuyang@gmail.com>
To: hdegoede@redhat.com, arnd@arndb.de, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org
Cc: Young Xiao <92siuyang@gmail.com>
Subject: [PATCH] vboxguest: check for private_data before trying to close it.
Date: Tue, 28 May 2019 20:47:14 +0800	[thread overview]
Message-ID: <1559047634-24397-1-git-send-email-92siuyang@gmail.com> (raw)

vbg_misc_device_close doesn't check that filp->private_data is non-NULL
before trying to close_session, where vbg_core_close_session uses pointer
session whithout checking, too. That can cause an oops in certain error
conditions that can occur on open or lookup before the private_data is set.

This vulnerability is similar to CVE-2011-1771.

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 drivers/virt/vboxguest/vboxguest_linux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/virt/vboxguest/vboxguest_linux.c b/drivers/virt/vboxguest/vboxguest_linux.c
index 6e8c0f1..b03c16f 100644
--- a/drivers/virt/vboxguest/vboxguest_linux.c
+++ b/drivers/virt/vboxguest/vboxguest_linux.c
@@ -88,8 +88,10 @@ static int vbg_misc_device_user_open(struct inode *inode, struct file *filp)
  */
 static int vbg_misc_device_close(struct inode *inode, struct file *filp)
 {
-	vbg_core_close_session(filp->private_data);
-	filp->private_data = NULL;
+	if (file->private_data != NULL) {
+		vbg_core_close_session(filp->private_data);
+		filp->private_data = NULL;
+	}
 	return 0;
 }
 
-- 
2.7.4


             reply	other threads:[~2019-05-28 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 12:47 Young Xiao [this message]
2019-05-28 13:19 ` Hans de Goede
2019-05-28 14:49   ` Yang Xiao
2019-05-28 14:51     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559047634-24397-1-git-send-email-92siuyang@gmail.com \
    --to=92siuyang@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] vboxguest: check for private_data before trying to close it.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).