tty: serial: msm: fix potential race b/w startup and irq handling
There is a potential race for tx/rx dma requests between msm_startup() and irq handling, for cases where dmas are not available. This results in irq path trying to do dma mapping, resulting in data abort. For example, consider below scenario where rx handler reads the intermediate value of dma->chan, set in msm_request_rx_dma(), and tries to do dma mapping, which results in data abort. uart_port_startup() msm_startup() request_irq() ... msm_request_rx_dma() ... dma->chan = dma_request_slave_channel_reason(dev, "rx"); <UART RX IRQ> msm_uart_irq() msm_handle_rx_dm() msm_start_rx_dma() dma->desc = dma_map_single() <data abort> Change-Id: Icf5d48f2718c3c6a855ffd3d10988a93f8281d78 Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
This commit is contained in:
parent
048c70075f
commit
beaa060bcc
1 changed files with 8 additions and 4 deletions
|
@ -303,15 +303,17 @@ static void msm_request_tx_dma(struct msm_port *msm_port, resource_size_t base)
|
||||||
struct device *dev = msm_port->uart.dev;
|
struct device *dev = msm_port->uart.dev;
|
||||||
struct dma_slave_config conf;
|
struct dma_slave_config conf;
|
||||||
struct msm_dma *dma;
|
struct msm_dma *dma;
|
||||||
|
struct dma_chan *dma_chan;
|
||||||
u32 crci = 0;
|
u32 crci = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dma = &msm_port->tx_dma;
|
dma = &msm_port->tx_dma;
|
||||||
|
|
||||||
/* allocate DMA resources, if available */
|
/* allocate DMA resources, if available */
|
||||||
dma->chan = dma_request_slave_channel_reason(dev, "tx");
|
dma_chan = dma_request_slave_channel_reason(dev, "tx");
|
||||||
if (IS_ERR(dma->chan))
|
if (IS_ERR(dma_chan))
|
||||||
goto no_tx;
|
goto no_tx;
|
||||||
|
dma->chan = dma_chan;
|
||||||
|
|
||||||
of_property_read_u32(dev->of_node, "qcom,tx-crci", &crci);
|
of_property_read_u32(dev->of_node, "qcom,tx-crci", &crci);
|
||||||
|
|
||||||
|
@ -346,15 +348,17 @@ static void msm_request_rx_dma(struct msm_port *msm_port, resource_size_t base)
|
||||||
struct device *dev = msm_port->uart.dev;
|
struct device *dev = msm_port->uart.dev;
|
||||||
struct dma_slave_config conf;
|
struct dma_slave_config conf;
|
||||||
struct msm_dma *dma;
|
struct msm_dma *dma;
|
||||||
|
struct dma_chan *dma_chan;
|
||||||
u32 crci = 0;
|
u32 crci = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dma = &msm_port->rx_dma;
|
dma = &msm_port->rx_dma;
|
||||||
|
|
||||||
/* allocate DMA resources, if available */
|
/* allocate DMA resources, if available */
|
||||||
dma->chan = dma_request_slave_channel_reason(dev, "rx");
|
dma_chan = dma_request_slave_channel_reason(dev, "rx");
|
||||||
if (IS_ERR(dma->chan))
|
if (IS_ERR(dma_chan))
|
||||||
goto no_rx;
|
goto no_rx;
|
||||||
|
dma->chan = dma_chan;
|
||||||
|
|
||||||
of_property_read_u32(dev->of_node, "qcom,rx-crci", &crci);
|
of_property_read_u32(dev->of_node, "qcom,rx-crci", &crci);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue