From: Willy Tarreau <w@1wt.eu>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Phillip Lougher" <plougher@redhat.com>,
"Jeff Mahoney" <jeffm@suse.com>, "Christoph Hellwig" <hch@lst.de>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Moritz Mühlenhoff" <jmm@inutil.org>,
"Greg KH" <gregkh@linuxfoundation.org>
Subject: [PATCH 61/91] hfs: fix hfs_find_init() sb->ext_tree NULL ptr oops
Date: Sun, 05 Feb 2012 23:10:50 +0100 [thread overview]
Message-ID: <20120205220952.057754032@pcw.home.local> (raw)
In-Reply-To: <0635750f5f06ed2ca212b91fcb5c4483@local>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3037 bytes --]
2.6.27-longterm review patch. If anyone has any objections, please let us know.
------------------
commit 434a964daa14b9db083ce20404a4a2add54d037a upstream.
Clement Lecigne reports a filesystem which causes a kernel oops in
hfs_find_init() trying to dereference sb->ext_tree which is NULL.
This proves to be because the filesystem has a corrupted MDB extent
record, where the extents file does not fit into the first three extents
in the file record (the first blocks).
In hfs_get_block() when looking up the blocks for the extent file
(HFS_EXT_CNID), it fails the first blocks special case, and falls
through to the extent code (which ultimately calls hfs_find_init())
which is in the process of being initialised.
Hfs avoids this scenario by always having the extents b-tree fitting
into the first blocks (the extents B-tree can't have overflow extents).
The fix is to check at mount time that the B-tree fits into first
blocks, i.e. fail if HFS_I(inode)->alloc_blocks >=
HFS_I(inode)->first_blocks
Note, the existing commit 47f365eb57573 ("hfs: fix oops on mount with
corrupted btree extent records") becomes subsumed into this as a special
case, but only for the extents B-tree (HFS_EXT_CNID), it is perfectly
acceptable for the catalog B-Tree file to grow beyond three extents,
with the remaining extent descriptors in the extents overfow.
[WT: patch edited - 47f365eb57573 was missing from 2.6.27.x]
This fixes CVE-2011-2203
Reported-by: Clement LECIGNE <clement.lecigne@netasq.com>
Signed-off-by: Phillip Lougher <plougher@redhat.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Moritz Mühlenhoff <jmm@inutil.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/hfs/btree.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
Index: longterm-2.6.27/fs/hfs/btree.c
===================================================================
--- longterm-2.6.27.orig/fs/hfs/btree.c 2012-02-05 22:34:33.129915287 +0100
+++ longterm-2.6.27/fs/hfs/btree.c 2012-02-05 22:34:43.555914905 +0100
@@ -45,11 +45,26 @@
case HFS_EXT_CNID:
hfs_inode_read_fork(tree->inode, mdb->drXTExtRec, mdb->drXTFlSize,
mdb->drXTFlSize, be32_to_cpu(mdb->drXTClpSiz));
+ if (HFS_I(tree->inode)->alloc_blocks >
+ HFS_I(tree->inode)->first_blocks) {
+ printk(KERN_ERR "hfs: invalid btree extent records\n");
+ unlock_new_inode(tree->inode);
+ goto free_inode;
+ }
+
tree->inode->i_mapping->a_ops = &hfs_btree_aops;
break;
case HFS_CAT_CNID:
hfs_inode_read_fork(tree->inode, mdb->drCTExtRec, mdb->drCTFlSize,
mdb->drCTFlSize, be32_to_cpu(mdb->drCTClpSiz));
+
+ if (!HFS_I(tree->inode)->first_blocks) {
+ printk(KERN_ERR "hfs: invalid btree extent records "
+ "(0 size).\n");
+ unlock_new_inode(tree->inode);
+ goto free_inode;
+ }
+
tree->inode->i_mapping->a_ops = &hfs_btree_aops;
break;
default:
next prev parent reply other threads:[~2012-02-05 22:27 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0635750f5f06ed2ca212b91fcb5c4483@local>
2012-02-05 22:09 ` [PATCH 00/91] 2.6.27.60-longterm review Willy Tarreau
2012-02-05 22:09 ` [PATCH 01/91] UBIFS: fix master node recovery Willy Tarreau
2012-02-05 22:09 ` [PATCH 02/91] slub: fix panic with DISCONTIGMEM Willy Tarreau
2012-02-06 21:58 ` David Rientjes
2012-02-07 6:13 ` Willy Tarreau
2012-02-05 22:09 ` [PATCH 03/91] set memory ranges in N_NORMAL_MEMORY when onlined Willy Tarreau
2012-02-05 22:09 ` [PATCH 04/91] agp: fix arbitrary kernel memory writes Willy Tarreau
2012-02-05 22:09 ` [PATCH 05/91] agp: fix OOM and buffer overflow Willy Tarreau
2012-02-05 22:09 ` [PATCH 06/91] put stricter guards on queue dead checks Willy Tarreau
2012-02-05 22:09 ` [PATCH 07/91] mmc: sdhci-pci: Fix error case in sdhci_pci_probe_slot() Willy Tarreau
2012-02-05 22:09 ` [PATCH 08/91] mmc: sdhci: Check mrq->cmd in sdhci_tasklet_finish Willy Tarreau
2012-02-05 22:09 ` [PATCH 09/91] mmc: sdhci: Check mrq != NULL " Willy Tarreau
2012-02-05 22:09 ` [PATCH 10/91] af_unix: Only allow recv on connected seqpacket sockets Willy Tarreau
2012-02-05 22:10 ` [PATCH 11/91] ARM: 6891/1: prevent heap corruption in OABI semtimedop Willy Tarreau
2012-02-05 22:10 ` [PATCH 12/91] Open with O_CREAT flag set fails to open existing files on non writable directories Willy Tarreau
2012-02-05 22:10 ` [PATCH 13/91] fs/partitions/ldm.c: fix oops caused by corrupted partition table Willy Tarreau
2012-02-05 22:10 ` [PATCH 14/91] SUNRPC: fix NFS client over TCP hangs due to packet loss (Bug 16494) Willy Tarreau
2012-02-05 22:10 ` [PATCH 15/91] Fix corrupted OSF partition table parsing Willy Tarreau
2012-02-05 22:10 ` [PATCH 16/91] sata_via: Delay on vt6420 when starting ATAPI DMA write Willy Tarreau
2012-02-05 22:10 ` [PATCH 17/91] libata: set queue DMA alignment to sector size for ATAPI too Willy Tarreau
2012-02-05 22:10 ` [PATCH 18/91] usb: musb: core: set has_tt flag Willy Tarreau
2012-02-05 22:10 ` [PATCH 19/91] Validate size of EFI GUID partition entries Willy Tarreau
2012-02-05 22:10 ` [PATCH 20/91] libertas: fix cmdpendingq locking Willy Tarreau
2012-02-05 22:10 ` [PATCH 21/91] powerpc/oprofile: Handle events that raise an exception without overflowing Willy Tarreau
2012-02-05 22:10 ` [PATCH 22/91] ext3: Fix fs corruption when make_indexed_dir() fails Willy Tarreau
2012-02-05 22:10 ` [PATCH 23/91] Fix for buffer overflow in ldm_frag_add not sufficient Willy Tarreau
2012-02-05 22:10 ` [PATCH 24/91] seqlock: Dont smp_rmb in seqlock reader spin loop Willy Tarreau
2012-02-05 22:10 ` [PATCH 25/91] x86/amd-iommu: Fix 3 possible endless loops Willy Tarreau
2012-02-05 22:10 ` [PATCH 26/91] md: check ->hot_remove_disk when removing disk Willy Tarreau
2012-02-05 22:10 ` [PATCH 27/91] uvcvideo: Remove buffers from the queues when freeing Willy Tarreau
2012-02-05 22:10 ` [PATCH 28/91] cfq-iosched: fix locking around ioc->ioc_data assignment Willy Tarreau
2012-02-05 22:10 ` [PATCH 29/91] cfq-iosched: fix a rcu warning Willy Tarreau
2012-02-05 22:10 ` [PATCH 30/91] SUNRPC: Fix use of static variable in rpcb_getport_async Willy Tarreau
2012-02-05 22:10 ` [PATCH 31/91] x86: Make Dell Latitude E5420 use reboot=pci Willy Tarreau
2012-02-05 22:10 ` [PATCH 32/91] libsas: remove expander from dev list on error Willy Tarreau
2012-02-05 23:48 ` Luben Tuikov
2012-02-06 0:52 ` Wanlong Gao
2012-02-06 1:14 ` Luben Tuikov
2012-02-06 6:25 ` Willy Tarreau
2012-02-05 22:10 ` [PATCH 33/91] powerpc/kdump: Fix timeout in crash_kexec_wait_realmode Willy Tarreau
2012-02-05 22:10 ` [PATCH 34/91] ext3: Fix oops in ext3_try_to_allocate_with_rsv() Willy Tarreau
2012-02-05 22:10 ` [PATCH 35/91] svcrpc: fix list-corrupting race on nfsd shutdown Willy Tarreau
2012-02-05 22:10 ` [PATCH 36/91] powerpc/pseries/hvconsole: Fix dropped console output Willy Tarreau
2012-02-05 22:10 ` [PATCH 37/91] alpha: fix several security issues Willy Tarreau
2012-02-05 22:10 ` [PATCH 38/91] ALSA: timer - Fix Oops at closing slave timer Willy Tarreau
2012-02-05 22:10 ` [PATCH 39/91] powerpc: Fix device tree claim code Willy Tarreau
2012-02-05 22:10 ` [PATCH 40/91] powerpc: pseries: Fix kexec on machines with more than 4TB of RAM Willy Tarreau
2012-02-05 22:10 ` [PATCH 41/91] xen/smp: Warn user why they keel over - nosmp or noapic and what to use instead Willy Tarreau
2012-02-06 16:50 ` Konrad Rzeszutek Wilk
2012-02-06 18:30 ` Willy Tarreau
2012-02-05 22:10 ` [PATCH 42/91] cifs: fix possible memory corruption in CIFSFindNext Willy Tarreau
2012-02-05 22:10 ` [PATCH 43/91] TPM: Call tpm_transmit with correct size Willy Tarreau
2012-02-05 22:10 ` [PATCH 44/91] TPM: Zero buffer after copying to userspace Willy Tarreau
2012-02-05 22:10 ` [PATCH 45/91] aacraid: reset should disable MSI interrupt Willy Tarreau
2012-02-05 22:10 ` [PATCH 46/91] libsas: fix panic when single phy is disabled on a wide port Willy Tarreau
2012-02-05 22:10 ` [PATCH 47/91] KVM: s390: check cpu_id prior to using it Willy Tarreau
2012-02-05 22:10 ` [PATCH 48/91] carminefb: Fix module parameters permissions Willy Tarreau
2012-02-05 22:10 ` [PATCH 49/91] um: fix ubd cow size Willy Tarreau
2012-02-05 22:10 ` [PATCH 50/91] NLM: Dont hang forever on NLM unlock requests Willy Tarreau
2012-02-05 22:10 ` [PATCH 51/91] Bluetooth: Prevent buffer overflow in l2cap config request Willy Tarreau
2012-02-05 22:10 ` [PATCH 52/91] net_sched: Fix qdisc_notify() Willy Tarreau
2012-02-05 22:10 ` [PATCH 53/91] ext4: fix BUG_ON() in ext4_ext_insert_extent() Willy Tarreau
2012-02-05 22:10 ` [PATCH 54/91] drivers/net/rionet.c: fix ethernet address macros for LE platforms Willy Tarreau
2012-02-05 22:10 ` [PATCH 55/91] Make scsi_free_queue() kill pending SCSI commands Willy Tarreau
2012-02-06 7:28 ` Bart Van Assche
2012-02-06 7:37 ` Willy Tarreau
2012-02-05 22:10 ` [PATCH 56/91] hfs: add sanity check for file name length Willy Tarreau
2012-02-05 22:10 ` [PATCH 57/91] USB: Fix Corruption issue in USB ftdi driver ftdi_sio.c Willy Tarreau
2012-02-05 22:10 ` [PATCH 58/91] oprofile, x86: Fix crash when unloading module (nmi timer mode) Willy Tarreau
2012-02-05 22:10 ` [PATCH 59/91] jbd/jbd2: validate sb->s_first in journal_get_superblock() Willy Tarreau
2012-02-05 22:10 ` [PATCH 60/91] Make TASKSTATS require root access Willy Tarreau
2012-02-05 22:10 ` Willy Tarreau [this message]
2012-02-05 22:10 ` [PATCH 62/91] [PATCH] x86, mm: Add __get_user_pages_fast() Willy Tarreau
2012-02-05 22:10 ` [PATCH 63/91] export __get_user_pages_fast() function Willy Tarreau
2012-02-05 22:10 ` [PATCH 64/91] oprofile, x86: Fix nmi-unsafe callgraph support Willy Tarreau
2012-02-05 22:10 ` [PATCH 65/91] ext4: avoid hangs in ext4_da_should_update_i_disksize() Willy Tarreau
2012-02-05 22:10 ` [PATCH 66/91] offb: Fix setting of the pseudo-palette for >8bpp Willy Tarreau
2012-02-05 22:10 ` [PATCH 67/91] offb: Fix bug in calculating requested vram size Willy Tarreau
2012-02-05 22:10 ` [PATCH 68/91] usb: usb-storage doesnt support dynamic id currently, the patch disables the feature to fix an oops Willy Tarreau
2012-02-05 22:10 ` [PATCH 69/91] SCSI: scsi_dh: check queuedata pointer before proceeding further Willy Tarreau
2012-02-05 22:10 ` [PATCH 70/91] ALSA: ice1724 - Check for ac97 to avoid kernel oops Willy Tarreau
2012-02-05 22:11 ` [PATCH 71/91] UBI: fix nameless volumes handling Willy Tarreau
2012-02-05 22:11 ` [PATCH 72/91] svcrpc: fix double-free on shutdown of nfsd after changing pool mode Willy Tarreau
2012-02-05 22:11 ` [PATCH 73/91] nfsd: Fix oops when parsing a 0 length export Willy Tarreau
2012-02-05 22:11 ` [PATCH 74/91] sym53c8xx: Fix NULL pointer dereference in slave_destroy Willy Tarreau
2012-02-05 22:11 ` [PATCH 75/91] [PATCH] bonding: correctly process non-linear skbs Willy Tarreau
2012-02-05 22:11 ` [PATCH 76/91] bonding: Ensure that we unshare skbs prior to calling pskb_may_pull Willy Tarreau
2012-02-05 22:11 ` [PATCH 77/91] block: add proper state guards to __elv_next_request Willy Tarreau
2012-02-05 22:11 ` [PATCH 78/91] x86, 64-bit: Fix copy_[to/from]_user() checks for the userspace address limit Willy Tarreau
2012-02-05 22:11 ` [PATCH 79/91] SCSI: scsi_lib: fix potential NULL dereference Willy Tarreau
2012-02-05 22:11 ` [PATCH 80/91] MAINTAINERS: stable: Update address Willy Tarreau
2012-02-05 22:11 ` [PATCH 81/91] af_packet: prevent information leak Willy Tarreau
2012-02-05 22:11 ` [PATCH 82/91] Fix time() inconsistencies caused by intermediate xtime_cache values being read Willy Tarreau
2012-02-05 22:11 ` [PATCH 83/91] net/ipv4: Check for mistakenly passed in non-IPv4 address Willy Tarreau
2012-02-05 22:11 ` [PATCH 84/91] x86: Fix mmap random address range Willy Tarreau
2012-02-05 22:11 ` [PATCH 85/91] i8k: Tell gcc that *regs gets clobbered Willy Tarreau
2012-02-05 22:11 ` [PATCH 86/91] Fix gcc 4.5.1 miscompiling drivers/char/i8k.c (again) Willy Tarreau
2012-02-05 22:11 ` [PATCH 87/91] kbuild: Disable -Wunused-but-set-variable for gcc 4.6.0 Willy Tarreau
2012-02-05 22:11 ` [PATCH 88/91] kbuild: Fix passing -Wno-* options to gcc 4.4+ Willy Tarreau
2012-02-05 22:11 ` [PATCH 89/91] i8k: Avoid lahf in 64-bit code Willy Tarreau
2012-02-05 22:11 ` [PATCH 90/91] block: fail SCSI passthrough ioctls on partition devices Willy Tarreau
2012-02-05 22:44 ` Paolo Bonzini
2012-02-05 22:53 ` Willy Tarreau
2012-02-07 10:03 ` Paolo Bonzini
2012-02-07 10:21 ` Willy Tarreau
2012-02-05 22:11 ` [PATCH 91/91] dm: do not forward ioctls from logical volumes to the underlying device Willy Tarreau
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=20120205220952.057754032@pcw.home.local \
--to=w@1wt.eu \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=jeffm@suse.com \
--cc=jmm@inutil.org \
--cc=linux-kernel@vger.kernel.org \
--cc=plougher@redhat.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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 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).