]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Fix infinite loop if receiving a NLMSG_NOOP packet.
authorKen'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Tue, 7 Apr 2009 05:02:24 +0000 (14:02 +0900)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Mon, 13 Apr 2009 11:22:53 +0000 (16:52 +0530)
Hi,

I tested 'cgred' service and I saw the problem that some processes
are not moved to a right cgroup. This problem did not occur always,
and it did sometimes. I reviewed cgrulesengd.c and found the bug
cgrulesengd stays in an infinite loop if receiving a NLMSG_NOOP
packet.

This patch fixes this problem.

Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
src/daemon/cgrulesengd.c

index 8efdce1aace9f88976aa054dfdf25dc9e8b71db0..4e00e184cb67d4f99c4c3c481d301db038a028da 100644 (file)
@@ -386,8 +386,10 @@ int cgre_create_netlink_socket_process_msg()
                        continue;
                while (NLMSG_OK(nlh, recv_len)) {
                        cn_hdr = NLMSG_DATA(nlh);
-                       if (nlh->nlmsg_type == NLMSG_NOOP)
+                       if (nlh->nlmsg_type == NLMSG_NOOP) {
+                               nlh = NLMSG_NEXT(nlh, recv_len);
                                continue;
+                       }
                        if ((nlh->nlmsg_type == NLMSG_ERROR) ||
                                        (nlh->nlmsg_type == NLMSG_OVERRUN))
                                break;