diff options
author | Anirudh Gargi <anirudh.gargi@intel.com> | 2018-09-10 10:12:01 +0530 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2018-09-10 11:04:11 -0500 |
commit | f2ebcf35d70a0136a3066f60b9fd3c6a71b36c82 (patch) | |
tree | 140663b603c7ae985767a7c6061d24010ed85935 /plugins/udevng.c | |
parent | 157d188587e8b3ef24fdbf37f8e200b70ba05171 (diff) | |
download | ofono-f2ebcf35d70a0136a3066f60b9fd3c6a71b36c82.tar.gz |
udev:fix seg fault in case of vid and pid is NULL
In some case linux report 'driver' as valid yet vid and pid as NULL.
Adding NULL check to prevent seg fault.
Log:
ofonod[23829]: plugins/udevng.c:udev_start()
ofonod[23829]: plugins/udevng.c:enumerate_devices()
ofonod[23829]: plugins/udevng.c:check_usb_device() hub [1d6b:0002]
ofonod[23829]: plugins/udevng.c:check_usb_device() usb [1d6b:0002]
ofonod[23829]: plugins/udevng.c:check_usb_device() usbhid [03f0:034a]
ofonod[23829]: plugins/udevng.c:check_usb_device() usbhid [03f0:034a]
ofonod[23829]: plugins/udevng.c:check_usb_device() usb [1d6b:0002]
ofonod[23829]: plugins/udevng.c:check_usb_device() cdc_acm [(null):(null)]
ofonod[23829]: Aborting (signal 11) [./src/ofonod]
Diffstat (limited to 'plugins/udevng.c')
-rw-r--r-- | plugins/udevng.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/udevng.c b/plugins/udevng.c index 71a70f0b..02d049ec 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -1741,6 +1741,9 @@ static void check_usb_device(struct udev_device *device) DBG("%s [%s:%s]", drv, vendor, model); + if (vendor == NULL || model == NULL) + return; + for (i = 0; vendor_list[i].driver; i++) { if (g_str_equal(vendor_list[i].drv, drv) == FALSE) continue; |