All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: Jan Kara <jack@suse.cz>, Jiri Slaby <jslaby@suse.cz>
Subject: [patch added to the 3.12 stable tree] udf: Check length of extended attributes and allocation descriptors
Date: Tue, 23 Jun 2015 17:26:36 +0200	[thread overview]
Message-ID: <1435073196-1429-5-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1435073196-1429-1-git-send-email-jslaby@suse.cz>

From: Jan Kara <jack@suse.cz>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 23b133bdc452aa441fcb9b82cbf6dd05cfd342d0 upstream.

Check length of extended attributes and allocation descriptors when
loading inodes from disk. Otherwise corrupted filesystems could confuse
the code and make the kernel oops.

Reported-by: Carl Henrik Lunde <chlunde@ping.uio.no>
Cc: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/udf/inode.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index cbc438e8f406..b0774f245199 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1493,6 +1493,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
 		iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint);
 	}
 
+	/*
+	 * Sanity check length of allocation descriptors and extended attrs to
+	 * avoid integer overflows
+	 */
+	if (iinfo->i_lenEAttr > bs || iinfo->i_lenAlloc > bs)
+		return;
+	/* Now do exact checks */
+	if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > bs)
+		return;
 	/* Sanity checks for files in ICB so that we don't get confused later */
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
 		/*
-- 
2.4.3


      parent reply	other threads:[~2015-06-23 15:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23 15:26 [patch added to the 3.12 stable tree] usb: renesas_usbhs: Fix fifo unclear in usbhsf_prepare_pop Jiri Slaby
2015-06-23 15:26 ` [patch added to the 3.12 stable tree] usb: renesas_usbhs: Don't disable the pipe if Control write status stage Jiri Slaby
2015-06-23 15:26 ` [patch added to the 3.12 stable tree] cpufreq: pcc: Enable autoload of pcc-cpufreq for ACPI processors Jiri Slaby
2015-06-23 15:26 ` [patch added to the 3.12 stable tree] udf: Remove repeated loads blocksize Jiri Slaby
2015-06-23 15:26 ` Jiri Slaby [this message]

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=1435073196-1429-5-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jack@suse.cz \
    --cc=stable@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.