From: Bastien Nocera <hadess@hadess.net>
To: BlueZ Hackers <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Possible infinite loop in inotify code
Date: Thu, 04 Oct 2007 16:27:35 +0100 [thread overview]
Message-ID: <1191511655.3479.13.camel@cookie.hadess.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Heya,
Uli mentioned a possible infinite loop in some circumstances:
https://bugzilla.redhat.com/show_bug.cgi?id=235307
Although I wasn't able to reproduce the bug, the attached patch looks
technically correct.
Cheers
--
Bastien Nocera <hadess@hadess.net>
[-- Attachment #2: bluez-utils-better-inotify-error.patch --]
[-- Type: text/x-patch, Size: 1171 bytes --]
? .deps
? .libs
? Makefile
? Makefile.in
? bluez-utils-better-inotify-error.patch
? test_textfile
Index: notify-inotify.c
===================================================================
RCS file: /cvsroot/bluez/utils/common/notify-inotify.c,v
retrieving revision 1.8
diff -u -p -r1.8 notify-inotify.c
--- notify-inotify.c 16 Feb 2007 20:18:37 -0000 1.8
+++ notify-inotify.c 4 Oct 2007 15:23:55 -0000
@@ -60,14 +60,21 @@ static gboolean io_event(GIOChannel *cha
memset(buf, 0, sizeof(buf));
err = g_io_channel_read(chan, (gchar *) buf, sizeof(buf) - 1, &len);
- if (err == G_IO_ERROR_AGAIN)
+ if (err == G_IO_STATUS_AGAIN) {
return TRUE;
+ } else if (err != G_IO_STATUS_NORMAL) {
+ error("Error reading from channel: No error given");
+ return FALSE;
+ }
while (len >= sizeof(struct inotify_event)) {
struct inotify_event *evt = (struct inotify_event *) ptr;
- if (evt->wd != wd || !callback)
+ if (evt->wd != wd || !callback) {
+ len -= sizeof(struct inotify_event) + evt->len;
+ ptr += sizeof(struct inotify_event) + evt->len;
continue;
+ }
if (evt->mask & (IN_CREATE | IN_MOVED_TO))
callback(NOTIFY_CREATE, evt->name, NULL);
[-- Attachment #3: Type: text/plain, Size: 314 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 164 bytes --]
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
next reply other threads:[~2007-10-04 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-04 15:27 Bastien Nocera [this message]
2007-10-04 16:02 ` [Bluez-devel] Possible infinite loop in inotify code Marcel Holtmann
2007-10-04 16:09 ` Bastien Nocera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1191511655.3479.13.camel@cookie.hadess.net \
--to=hadess@hadess.net \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.