jtamate created this revision.
jtamate added a reviewer: Frameworks.
jtamate requested review of this revision.

REVISION SUMMARY
  When the device is blocked, for example by amarok mtp plugin, the result of 
LIBMTP_Open_Raw_Device_Uncached(rawDevice) is nullptr and 
  LIBMTP_Get_Friendlyname(nullptr) crashes.
  
  Avoid to create a cache for a device that can't be opened.
  
  CCBUG: 396527

TEST PLAN
  With Amarok started and its mtp plugin enabled, plug in an android device.
  Try to open it with dolphin, always the same kio backtrace:
  
    ==13233== Invalid read of size 8
    ==13233==    at 0x1087ABCE: LIBMTP_Get_Friendlyname (in 
/usr/lib64/libmtp.so.9.4.0)
    ==13233==    by 0x105EE67C: 
CachedDevice::CachedDevice(LIBMTP_mtpdevice_struct*, LIBMTP_raw_device_struct*, 
QString, int) (devicecache.cpp:44)
    ==13233==    by 0x105F0A30: DeviceCache::checkDevice(Solid::Device) 
(devicecache.cpp:150)
    ==13233==    by 0x105F1517: DeviceCache::DeviceCache(int, QObject*) 
(devicecache.cpp:94)
    ==13233==    by 0x105F2FC1: MTPSlave::MTPSlave(QByteArray const&, 
QByteArray const&) (kio_mtp.cpp:70)
    ==13233==    by 0x105F8BF9: kdemain (kio_mtp.cpp:54)
    ==13233==    by 0x4016CC: main (kioslave.cpp:130)
    ==13233==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
  
  And in dolphin, the message: MTP died unexpectedly
  
  After, the message: The file or folder 
udi=/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1 does not 
exist.

REPOSITORY
  R320 KIO Extras

REVISION DETAIL
  https://phabricator.kde.org/D14158

AFFECTED FILES
  mtp/devicecache.cpp

To: jtamate, #frameworks

Reply via email to