public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Possible null pointer dereference in rcar-dmac.ko
@ 2017-08-08 12:09 Anton Volkov
  2017-08-09  0:49 ` Kuninori Morimoto
  0 siblings, 1 reply; 6+ messages in thread
From: Anton Volkov @ 2017-08-08 12:09 UTC (permalink / raw)
  To: niklas.soderlund+renesas, geert+renesas, kuninori.morimoto.gx
  Cc: vinod.koul, dmaengine, linux-kernel, ldv-project,
	Alexey Khoroshilov

Hello.

While searching for races in the Linux kernel I've come across 
"drivers/dma/sh/rcar-dmac.ko" module. Here is a question that I came up 
with while analyzing results. Lines are given using the info from Linux 
v4.12.

Consider the following case:

Thread 1:                            Thread 2:
rcar_dmac_probe
->rcar_dmac_chan_probe
              (&dmac->channels[i])
     rchan = &dmac->channels[i]
     chan = &rchan->chan
     devm_request_threaded_irq(rchan)
     chan->device = &dmac->engine    rcar_dmac_isr_channel
                                     ->rcar_dmac_isr_transfer_end(chan)
                                       ->rcar_dmac_chan_start_xfer(chan)
   engine->dev = &pdev->dev;               <READ chan->chan.device->dev>
   (rcar-dmac.c: line 1828)                (rcar-dmac.c: line 351)

As far as I understand engine->dev is NULL before its initialization in 
probe. Thus there might be a NULL pointer dereference in 
rcar_dmac_chan_start_xfer while accessing chan->chan.device->dev which 
is equal to (&dmac->engine)->dev. Is this possible from your point of view?

Thank you for your time.

-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-08-21  6:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 12:09 Possible null pointer dereference in rcar-dmac.ko Anton Volkov
2017-08-09  0:49 ` Kuninori Morimoto
2017-08-09  7:58   ` Laurent Pinchart
2017-08-10  2:09     ` Kuninori Morimoto
2017-08-10 14:59       ` Laurent Pinchart
2017-08-21  6:15         ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox