Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3158 closed Bug (fixed)

Possible crash when using inotify

Reported by: KyleK Owned by: KyleK
Priority: Normal Milestone: 1.93
Component: Daemon Version: 1.92
Severity: Major Keywords:
Cc:

Description

transmission-daemon does not check the return value of inotify_init() when the watchdir feature is enabled. The method returns a file descriptor that is used to "observe" changes in the given folder. Apparently, inotify_add_watch() doesn't care about an invalid file descriptor, so it doesn't report an error.

If inotify_init() fails, the daemon will crash later on in watchdir_update_impl(), because FD_SET() cannot cope with a file descriptor of -1.

The attached patch should fix this potential crasher.

Attachments (1)

inotify_01.patch (481 bytes) - added by KyleK 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by KyleK

comment:1 Changed 11 years ago by charles

  • Keywords backport-1.9x added
  • Milestone changed from None Set to 2.00
  • Owner set to KyleK

comment:2 Changed 11 years ago by charles

KyleK: the man page for inotify_add_watch() says passing in an invalid file descriptor will make it return -1 and set errno to EBADF. That's not the behavior you're seeing?

comment:3 Changed 11 years ago by charles

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in trunk for 2.00 for r10504.

comment:4 Changed 11 years ago by charles

  • Keywords backport-1.9x removed
  • Milestone changed from 2.00 to 1.93

Backported to 1.9x by r10569

Note: See TracTickets for help on using tickets.