Skip to contentSkip to conversation

media: mxl111sf: fix null pointer dereference in mxl111sf_ctrl_msg

PATCH New Moksh Panicker 2 participants 2 messages May 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: mxl111sf: fix null pointer dereference in mxl111sf_ctrl_msg

When mxl111sf_ctrl_msg() is called during early probe, state->d may not yet be initialized, causing a null pointer dereference in dvb_usbv2_generic_write() when it accesses d->usb_mutex.

Add a null check for d before proceeding with the USB transfer.

Fixes d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages")
Reported-by [email protected]
---
 drivers/media/usb/dvb-usb-v2/mxl111sf.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/usb/dvb-usb-v2/mxl111sf.c +3 -0
index 870ac3c8b085..9908675c355e 100644
@@ -56,6 +56,9 @@ int mxl111sf_ctrl_msg(struct mxl111sf_state *state,
 	int wo = (rbuf == NULL || rlen == 0); /* write-only */
 	int ret;
 
+	if (!d)
+		return -ENODEV;
+
 	if (1 + wlen > MXL_MAX_XFER_SIZE) {
 		pr_warn("%s: len=%d is too big!\n", __func__, wlen);
 		return -EOPNOTSUPP;
Signature · 1 line
2.34.1
syzbot
#1 lore raw
I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the…
Quoted 31 lines

When mxl111sf_ctrl_msg() is called during early probe, state->d may not yet be initialized, causing a null pointer dereference in dvb_usbv2_generic_write() when it accesses d->usb_mutex.

Add a null check for d before proceeding with the USB transfer.

Fixes d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages")
Reported-by [email protected]
---
 drivers/media/usb/dvb-usb-v2/mxl111sf.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/usb/dvb-usb-v2/mxl111sf.c +3 -0
index 870ac3c8b085..9908675c355e 100644
@@ -56,6 +56,9 @@ int mxl111sf_ctrl_msg(struct mxl111sf_state *state,
 	int wo = (rbuf == NULL || rlen == 0); /* write-only */
 	int ret;
 
+	if (!d)
+		return -ENODEV;
+
 	if (1 + wlen > MXL_MAX_XFER_SIZE) {
 		pr_warn("%s: len=%d is too big!\n", __func__, wlen);
 		return -EOPNOTSUPP;
Signature · 1 line
2.34.1

I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the address.