Mark Cave-Ayland 441f6692ec fdc: fix segfault in fdctrl_stop_transfer() when DMA is disabled
Commit c8a35f1cf0f "fdc: use IsaDma interface instead of global DMA_*
functions" accidentally introduced a segfault in fdctrl_stop_transfer() for
non-DMA transfers.

If fdctrl->dma_chann has not been configured then the fdctrl->dma interface
reference isn't initialised during isabus_fdc_realize(). Unfortunately
fdctrl_stop_transfer() unconditionally references the DMA interface when
finishing the transfer causing a NULL pointer dereference.

Fix the issue by adding a check in fdctrl_stop_transfer() so that the DMA
interface reference and release method is only invoked if fdctrl->dma_chann
has been set.

(This issue was discovered by Martin testing a recent change in the NetBSD
installer under qemu-system-sparc)

Cc: qemu-stable@nongnu.org
Reported-by: Martin Husemann <martin@duskware.de>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-11-19 12:51:22 +01:00
..
2018-11-02 14:03:33 +00:00
2018-10-25 20:17:12 +01:00
2018-10-24 06:44:59 -03:00
2018-10-24 06:44:59 -03:00
2018-11-12 11:26:02 +00:00
2018-11-05 13:24:02 -05:00
2018-11-08 14:42:37 +00:00
2016-01-29 15:07:25 +00:00
2018-08-18 18:01:34 +03:00
2018-11-08 10:01:51 +00:00
2018-11-05 09:55:01 +01:00
2018-10-26 17:17:32 +02:00