[2/5] usb-mtp: print parent path in IN_IGNORED trace fn

Message ID 20170914053148.2512-3-bsd@redhat.com
State New
Headers show
Series
  • Untitled series #3035
Related show

Commit Message

Bandan Das Sept. 14, 2017, 5:31 a.m.
From: Bandan Das <bsd@makefile.in>

Fix a possible null dereference when deleting a folder and
its contents. An ignored event might be received for its contents
after the parent folder is deleted which will return a null object.

Signed-off-by: Bandan Das <bsd@makefile.in>
---
 hw/usb/dev-mtp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Patch

diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index b55aa82..63f8f3b 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -540,9 +540,8 @@  static void inotify_watchfn(void *arg)
                 break;
 
             case IN_IGNORED:
-                o = usb_mtp_object_lookup_name(parent, event->name, event->len);
-                trace_usb_mtp_inotify_event(s->dev.addr, o->path,
-                                      event->mask, "Obj ignored");
+                trace_usb_mtp_inotify_event(s->dev.addr, parent->path,
+                                      event->mask, "Obj parent dir ignored");
                 break;
 
             default: