Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f51dd69f authored by Sriharsha Allenki's avatar Sriharsha Allenki Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3-msm: Fix NULL pointer dereference in gsi_ring_db



If the obtained GSI door bell address in gsi_ring_db
is NULL, it will result in NULL pointer dereference.
Fix this by bailing out from the function if the
address is NULL.

Also change the dev_dbg to dev_err for more
visibility in case of error.

Change-Id: Idfb71cbdbd0b92d54f14951770e0961ab176ad6f
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent e4ab9297
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1047,13 +1047,17 @@ static void gsi_ring_db(struct usb_ep *ep, struct usb_gsi_request *request)

	gsi_dbl_address_lsb = devm_ioremap_nocache(mdwc->dev,
				request->db_reg_phs_addr_lsb, sizeof(u32));
	if (!gsi_dbl_address_lsb)
		dev_dbg(mdwc->dev, "Failed to get GSI DBL address LSB\n");
	if (!gsi_dbl_address_lsb) {
		dev_err(mdwc->dev, "Failed to get GSI DBL address LSB\n");
		return;
	}

	gsi_dbl_address_msb = devm_ioremap_nocache(mdwc->dev,
			request->db_reg_phs_addr_msb, sizeof(u32));
	if (!gsi_dbl_address_msb)
		dev_dbg(mdwc->dev, "Failed to get GSI DBL address MSB\n");
	if (!gsi_dbl_address_msb) {
		dev_err(mdwc->dev, "Failed to get GSI DBL address MSB\n");
		return;
	}

	offset = dwc3_trb_dma_offset(dep, &dep->trb_pool[num_trbs-1]);
	dev_dbg(mdwc->dev, "Writing link TRB addr: %pa to %pK (%x) for ep:%s\n",