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/core | |
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/core')
-rw-r--r-- | net/core/netpoll.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index b4c90e42b443..37cc854774a4 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -715,7 +715,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt) | |||
715 | } | 715 | } |
716 | EXPORT_SYMBOL(netpoll_parse_options); | 716 | EXPORT_SYMBOL(netpoll_parse_options); |
717 | 717 | ||
718 | int __netpoll_setup(struct netpoll *np, struct net_device *ndev) | 718 | int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) |
719 | { | 719 | { |
720 | struct netpoll_info *npinfo; | 720 | struct netpoll_info *npinfo; |
721 | const struct net_device_ops *ops; | 721 | const struct net_device_ops *ops; |
@@ -734,7 +734,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) | |||
734 | } | 734 | } |
735 | 735 | ||
736 | if (!ndev->npinfo) { | 736 | if (!ndev->npinfo) { |
737 | npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL); | 737 | npinfo = kmalloc(sizeof(*npinfo), gfp); |
738 | if (!npinfo) { | 738 | if (!npinfo) { |
739 | err = -ENOMEM; | 739 | err = -ENOMEM; |
740 | goto out; | 740 | goto out; |
@@ -752,7 +752,7 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) | |||
752 | 752 | ||
753 | ops = np->dev->netdev_ops; | 753 | ops = np->dev->netdev_ops; |
754 | if (ops->ndo_netpoll_setup) { | 754 | if (ops->ndo_netpoll_setup) { |
755 | err = ops->ndo_netpoll_setup(ndev, npinfo); | 755 | err = ops->ndo_netpoll_setup(ndev, npinfo, gfp); |
756 | if (err) | 756 | if (err) |
757 | goto free_npinfo; | 757 | goto free_npinfo; |
758 | } | 758 | } |
@@ -857,7 +857,7 @@ int netpoll_setup(struct netpoll *np) | |||
857 | refill_skbs(); | 857 | refill_skbs(); |
858 | 858 | ||
859 | rtnl_lock(); | 859 | rtnl_lock(); |
860 | err = __netpoll_setup(np, ndev); | 860 | err = __netpoll_setup(np, ndev, GFP_KERNEL); |
861 | rtnl_unlock(); | 861 | rtnl_unlock(); |
862 | 862 | ||
863 | if (err) | 863 | if (err) |