diff options
author | Amerigo Wang <amwang@redhat.com> | 2012-08-09 21:24:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-14 17:33:30 -0400 |
commit | 47be03a28cc6c80e3aa2b3e8ed6d960ff0c5c0af (patch) | |
tree | ba11046ff60d948cd4db06652e2483537387b3ca /net/8021q | |
parent | ddf343f635fe4440cad528e12f96f28bd50aa099 (diff) |
netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()
slave_enable_netpoll() and __netpoll_setup() may be called
with read_lock() held, so should use GFP_ATOMIC to allocate
memory. Eric suggested to pass gfp flags to __netpoll_setup().
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan_dev.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 73a2a83ee2da..ee4ae0944cef 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -669,19 +669,20 @@ static void vlan_dev_poll_controller(struct net_device *dev) | |||
669 | return; | 669 | return; |
670 | } | 670 | } |
671 | 671 | ||
672 | static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *npinfo) | 672 | static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *npinfo, |
673 | gfp_t gfp) | ||
673 | { | 674 | { |
674 | struct vlan_dev_priv *info = vlan_dev_priv(dev); | 675 | struct vlan_dev_priv *info = vlan_dev_priv(dev); |
675 | struct net_device *real_dev = info->real_dev; | 676 | struct net_device *real_dev = info->real_dev; |
676 | struct netpoll *netpoll; | 677 | struct netpoll *netpoll; |
677 | int err = 0; | 678 | int err = 0; |
678 | 679 | ||
679 | netpoll = kzalloc(sizeof(*netpoll), GFP_KERNEL); | 680 | netpoll = kzalloc(sizeof(*netpoll), gfp); |
680 | err = -ENOMEM; | 681 | err = -ENOMEM; |
681 | if (!netpoll) | 682 | if (!netpoll) |
682 | goto out; | 683 | goto out; |
683 | 684 | ||
684 | err = __netpoll_setup(netpoll, real_dev); | 685 | err = __netpoll_setup(netpoll, real_dev, gfp); |
685 | if (err) { | 686 | if (err) { |
686 | kfree(netpoll); | 687 | kfree(netpoll); |
687 | goto out; | 688 | goto out; |