<div dir="ltr"><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)">Hi,</pre><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)">I am a security researcher, my name is Dongyang Zhan. I found a potential bug in </pre><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif">/drivers/md/dm-region-hash.c</span> in Linux 4.10.17. I hope you can help me to confirm it. </pre><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></pre><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)"><span style="font-family:Arial,Helvetica,sans-serif">__rh_alloc() in /drivers/md/dm-region-hash.c mishandles the memory allocation failures of nreg. </span><br></pre><pre id="gmail-m_-4853843472690211139gmail-m_-847641244839025803gmail-m_4091962907303224627gmail-m_-7092909529653893599gmail-m_-8558348290116643165gmail-m_-7810375000073948968gmail-comment_text_0" style="white-space:pre-wrap;font-size:medium;width:50em;color:rgb(0,0,0)"><pre class="gmail-bz_comment_text" id="gmail-comment_text_0" style="width:50em;white-space:pre-wrap">Source code:

struct dm_region *reg, *nreg;

nreg = mempool_alloc(rh->region_pool, GFP_ATOMIC);
if (unlikely(!nreg))
                nreg = kmalloc(sizeof(*nreg), GFP_NOIO | __GFP_NOFAIL);

nreg->state = rh->log->type->in_sync(rh->log, region, 1) ?
                DM_RH_CLEAN : DM_RH_NOSYNC;

If the statement (nreg = kmalloc(sizeof(*nreg), GFP_NOIO | __GFP_NOFAIL);) fails,
dereferencing this pointer (nreg->state) will cause null pointer dereference.</pre>

</pre></div>