]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix mailbox list notification assert-crash when mailbox is deleted
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 11 Sep 2017 09:27:17 +0000 (12:27 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Wed, 13 Sep 2017 15:04:25 +0000 (18:04 +0300)
Reproduced with if IMAP NOTIFY is used for non-selected mailboxes without
MailboxName being specified. Another session then does changes to a
mailbox and immediately deletes it, which causes the crash.

Fixes:
Panic: file mailbox-list-index-notify.c: line 751: unreached

src/lib-storage/list/mailbox-list-index-notify.c

index 249d09f25f39f6af61d9c07865320a8fd9a9f5c2..d121ff50ad613e514dc98305f7d15554fdbd2b04 100644 (file)
@@ -748,8 +748,12 @@ mailbox_list_index_notify_change(struct mailbox_list_notify_index *inotify,
 
        if (!mailbox_list_index_notify_lookup(inotify, inotify->view,
                                              uid, notify_status_items,
-                                             &status, &rec))
-               i_unreached();
+                                             &status, &rec)) {
+               /* Mailbox is already deleted. We won't get here if we're
+                  tracking MAILBOX_LIST_NOTIFY_DELETE or _RENAME
+                  (which update expunged_uids). */
+               return FALSE;
+       }
 
        /* get the old status */
        nnode = mailbox_list_notify_tree_lookup(inotify->tree,