media: mxl111sf: fix null pointer dereference in mxl111sf_ctrl_msg
Subsystems (3)
PATCH v5 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")
Signed-off-by Moksh Panicker <[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
@@ -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