datapath: Don't call genlmsg_reply() under rcu_read_lock().
authorJesse Gross <jesse@nicira.com>
Fri, 27 May 2011 22:57:28 +0000 (15:57 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 27 May 2011 23:37:34 +0000 (16:37 -0700)
genlmsg_reply() indirectly makes a call to kmalloc but takes no
GFP flags, instead using GFP_ATOMIC if in a softirq and GFP_KERNEL
otherwise.  However, here we hold rcu_read_lock(), which requires
GFP_ATOMIC but is not a softirq.  Since we've already built the
reply message, it is safe to release rcu_read_lock(), so do that
before calling genlmsg_reply().

Signed-off-by: Jesse Gross <jesse@nicira.com>
CC: Hao Zheng <hzheng@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/datapath.c

index 826d8991eb2f371b5d17d0ba143d4297057ee64c..72801224984c94a8954a5473b5e3110ba004dff9 100644 (file)
@@ -1904,7 +1904,9 @@ static int odp_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
        if (IS_ERR(reply))
                goto exit_unlock;
 
-       err = genlmsg_reply(reply, info);
+       rcu_read_unlock();
+
+       return genlmsg_reply(reply, info);
 
 exit_unlock:
        rcu_read_unlock();