<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:13:14 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-7940] Null pointer may be passed to function ldiskfs_flex_group_add() that may dereference it</title>
                <link>https://jira.whamcloud.com/browse/LU-7940</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;1574		&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; ldiskfs_group_add(struct super_block *sb, struct ldiskfs_new_group_data *input)
1575		{
1576			struct ldiskfs_new_flex_group_data flex_gd;
1577			struct ldiskfs_sb_info *sbi = LDISKFS_SB(sb);
1578			struct ldiskfs_super_block *es = sbi-&amp;gt;s_es;
1579			&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; reserved_gdb = ldiskfs_bg_has_super(sb, input-&amp;gt;group) ?
1580				le16_to_cpu(es-&amp;gt;s_reserved_gdt_blocks) : 0;
1581			struct inode *inode = NULL;
1582			&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; gdb_off;
1583			&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; err;
1584			__u16 bg_flags = 0;
1585		 
1586			gdb_off = input-&amp;gt;group % LDISKFS_DESC_PER_BLOCK(sb);
1587		 
1588			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (gdb_off == 0 &amp;amp;&amp;amp; !LDISKFS_HAS_RO_COMPAT_FEATURE(sb,
1589							LDISKFS_FEATURE_RO_COMPAT_SPARSE_SUPER)) {
1590				ldiskfs_warning(sb, &lt;span class=&quot;code-quote&quot;&gt;&quot;Can&apos;t resize non-sparse filesystem further&quot;&lt;/span&gt;);
1591				&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; -EPERM;
1592			}
1593		 
1594			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (ldiskfs_blocks_count(es) + input-&amp;gt;blocks_count &amp;lt;
1595			    ldiskfs_blocks_count(es)) {...}
1599		 
1600			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (le32_to_cpu(es-&amp;gt;s_inodes_count) + LDISKFS_INODES_PER_GROUP(sb) &amp;lt;
1601			    le32_to_cpu(es-&amp;gt;s_inodes_count)) {...}
1605		 
1606			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (reserved_gdb || gdb_off == 0) {
1607				&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!LDISKFS_HAS_COMPAT_FEATURE(sb,
1608							     LDISKFS_FEATURE_COMPAT_RESIZE_INODE)
1609				    || !le16_to_cpu(es-&amp;gt;s_reserved_gdt_blocks)) {...}
1614				inode = ldiskfs_iget(sb, LDISKFS_RESIZE_INO);
1615				&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (IS_ERR(inode)) {
1616					ldiskfs_warning(sb, &lt;span class=&quot;code-quote&quot;&gt;&quot;Error opening resize inode&quot;&lt;/span&gt;);
1617					&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; PTR_ERR(inode);
1618				}
1619			}
1620		 
1621		 
1622			err = verify_group_input(sb, input);
1623			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (err)
1624				&lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; out;
1625		 
1626			err = ldiskfs_alloc_flex_bg_array(sb, input-&amp;gt;group + 1);
1627			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (err)
1628				&lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; out;
1629		 
1630			err = ldiskfs_mb_alloc_groupinfo(sb, input-&amp;gt;group + 1);
1631			&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (err)
1632				&lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; out;
1633		 
1634			flex_gd.count = 1;
1635			flex_gd.groups = input;
1636			flex_gd.bg_flags = &amp;amp;bg_flags;
1637			err = ldiskfs_flex_group_add(sb, inode, &amp;amp;flex_gd);
1638		out:
1639			iput(inode);
1640			&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; err;
1641		} &lt;span class=&quot;code-comment&quot;&gt;/* ldiskfs_group_add */&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;TRACEBACK&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1581: &apos;inode&apos; has been assigned a NULL value.&lt;/li&gt;
	&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1588: gdb_off==0&amp;amp;&amp;amp; ! ( (LDISKFS_SB(sb) &amp;#45;&amp;gt;s_es&amp;#45;&amp;gt;s_feature_ro_compat&amp;amp; ( (_&lt;em&gt;le32) (&lt;/em&gt;_u32) (1) ) ) !=0) is false&lt;/li&gt;
	&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1606: reserved_gdb||gdb_off==0 is false
	&lt;ul&gt;
		&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1637: &apos;inode&apos; is dereferenced by passing argument 2 to function &apos;ldiskfs_flex_group_add&apos;.&lt;/li&gt;
		&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1411: &apos;resize_inode&apos; is passed to function &apos;ldiskfs_flex_group_add&apos;.
		&lt;ul&gt;
			&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1457: &apos;resize_inode&apos; is dereferenced by passing argument 4 to function &apos;ldiskfs_add_new_descs&apos;.&lt;/li&gt;
			&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1152: &apos;resize_inode&apos; is passed to function &apos;ldiskfs_add_new_descs&apos;.&lt;/li&gt;
			&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1180: ldiskfs_bg_num_gdb(sb, group) is false&lt;/li&gt;
			&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1180: !err&amp;amp;&amp;amp;reserved_gdb&amp;amp;&amp;amp;ldiskfs_bg_num_gdb(sb, group) is false
			&lt;ul&gt;
				&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1185: &apos;resize_inode&apos; is dereferenced by passing argument 2 to function &apos;add_new_gdb&apos;.&lt;/li&gt;
				&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:753: &apos;inode&apos; is passed to function &apos;add_new_gdb&apos;.&lt;/li&gt;
				&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:756: &apos;inode&apos; is explicitly dereferenced.&lt;/li&gt;
			&lt;/ul&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="35681">LU-7940</key>
            <summary>Null pointer may be passed to function ldiskfs_flex_group_add() that may dereference it</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="dmiter">Dmitry Eremin</reporter>
                        <labels>
                            <label>kw</label>
                    </labels>
                <created>Tue, 29 Mar 2016 16:20:16 +0000</created>
                <updated>Sat, 10 Mar 2018 03:48:40 +0000</updated>
                                            <version>Lustre 2.9.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                            <comments>
                            <comment id="147213" author="dmiter" created="Tue, 29 Mar 2016 16:25:13 +0000"  >&lt;p&gt;The same issue in int ldiskfs_resize_fs(struct super_block *sb, ldiskfs_fsblk_t n_blocks_count):&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Null pointer &apos;resize_inode&apos; that comes from line 1875 may be passed to function and can be dereferenced there by passing argument 2 to function &apos;ldiskfs_flex_group_add&apos; at line 2004.
	&lt;ul&gt;
		&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:1875: &apos;resize_inode&apos; has been assigned a NULL value.&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1923: ( (LDISKFS_SB(sb) &amp;#45;&amp;gt;s_es&amp;#45;&amp;gt;s_feature_compat&amp;amp; ( (_&lt;em&gt;le32) (&lt;/em&gt;_u32) (16) ) ) !=0) is false&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1947: !resize_inode is true&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1951: resize_inode is false&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1955: n_blocks_count_retry is false&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1947: ( !resize_inode&amp;amp;&amp;amp; !meta_bg) ||n_blocks_count==o_blocks_count is false&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1993: Entering loop, because ldiskfs_setup_next_flex_gd(sb, flex_gd, n_blocks_count, flexbg_size) is true&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:1996: last_update_time is false&lt;/li&gt;
		&lt;li&gt;A condition which occurs, leading to the defect&lt;br/&gt;
resize.c:2002: ldiskfs_alloc_group_tables(sb, flex_gd, flexbg_size) !=0 is false
		&lt;ul&gt;
			&lt;li&gt;An event which alters the program&apos;s state, leading to the defect&lt;br/&gt;
resize.c:2004: &apos;resize_inode&apos; is dereferenced by passing argument 2 to function &apos;ldiskfs_flex_group_add&apos;.&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzy63b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>