2.1
CWE
476 264
Advisory Published
CVE Published
Updated

CVE-2011-2203: Null Pointer Dereference

First published: Mon Jun 13 2011(Updated: )

hfs_find_init() is wrongly assuming that sb-&gt;ext_tree has already been opened and is not NULL but this function can be called when sb-&gt;ext_tree is currently being opened (NULL deref). Indeed when we have the following call path, the NULL deref. occurs: In hfs_mdb_get() we have (at this stage ext_tree == NULL): HFS_SB(sb)-&gt;ext_tree = hfs_btree_open(sb, HFS_EXT_CNID, hfs_ext_keycmp); hfs_btree_open() is calling read_mapping_page() which is indirectly a call to hfs_readpage(). Then hfs_readpage() can make the following calls: hfs_readpage() -&gt; hfs_get_block() -&gt; alloc_buffer_head() -&gt; hfs_ext_read_extent() Then hfs_ext_read_extent() calls hfs_find_init() with an ext_tree == NULL. Then we have a NULL dereference in hfs_find_init(). ptr = kmalloc(tree-&gt;max_key_len (...)); Due to the huge call stack from hfs_btree_open() to hfs_find_init() there are many ways to fix this dereference but I can't find the proper way to fix it. Moreover if we look at the code in hfs_find_init(). 20 ptr = kmalloc(tree-&gt;max_key_len * 2 + 4, GFP_KERNEL); 21 if (!ptr) 22 return -ENOMEM; 23 fd-&gt;search_key = ptr; 24 fd-&gt;key = ptr + tree-&gt;max_key_len + 2; We can make "max_key_len * 2 + 4" wrap and have an fd-&gt;key pointing outside of the kmalloc()'ed space. Moreover we can make space in fd-&gt;search_key lower than max_key_len and bad things can occur. Reference: <a href="https://lkml.org/lkml/2011/6/8/154">https://lkml.org/lkml/2011/6/8/154</a> Acknowledgements: Red Hat would like to thank Clement Lecigne for reporting this issue.

Credit: secalert@redhat.com secalert@redhat.com

Affected SoftwareAffected VersionHow to fix
Linux Linux kernel=2.6
debian/linux-2.6

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203