usb: gadget: f_fs: Fix NULL reference in ffs_func_bind()
commit e4ed11d6 ("usb: gadget: f_fs: Support multi-instance IPC logging") moved the ipc_log context pointer to struct ffs_data, so using ffs_log() requires an instance of 'ffs' pointer. In ffs_do_functionfs_bind() this pointer is obtained via ffs_opts->dev->ffs_data. However in case userspace has not written out the descriptors, at the time of function bind, this would be NULL and result in invalid dereference by the log macro. For this instance there is no other way to obtain the ffs_data so simply drop this log to avoid referencing the potential NULL pointer. Similarly in the calling function ffs_func_bind(), move the logging of the entry point to after checking of ffs_opts, as only success indicates a valid ffs_data. Change-Id: Id38ac1aadbd2e08f5be077e78569ec415c096e28 Signed-off-by:Jack Pham <jackp@codeaurora.org>
Loading
Please register or sign in to comment