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 /drivers/net/team | |
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 'drivers/net/team')
-rw-r--r-- | drivers/net/team/team.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 87707ab39430..341b65dbbcd3 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -795,16 +795,17 @@ static void team_port_leave(struct team *team, struct team_port *port) | |||
795 | } | 795 | } |
796 | 796 | ||
797 | #ifdef CONFIG_NET_POLL_CONTROLLER | 797 | #ifdef CONFIG_NET_POLL_CONTROLLER |
798 | static int team_port_enable_netpoll(struct team *team, struct team_port *port) | 798 | static int team_port_enable_netpoll(struct team *team, struct team_port *port, |
799 | gfp_t gfp) | ||
799 | { | 800 | { |
800 | struct netpoll *np; | 801 | struct netpoll *np; |
801 | int err; | 802 | int err; |
802 | 803 | ||
803 | np = kzalloc(sizeof(*np), GFP_KERNEL); | 804 | np = kzalloc(sizeof(*np), gfp); |
804 | if (!np) | 805 | if (!np) |
805 | return -ENOMEM; | 806 | return -ENOMEM; |
806 | 807 | ||
807 | err = __netpoll_setup(np, port->dev); | 808 | err = __netpoll_setup(np, port->dev, gfp); |
808 | if (err) { | 809 | if (err) { |
809 | kfree(np); | 810 | kfree(np); |
810 | return err; | 811 | return err; |
@@ -833,7 +834,8 @@ static struct netpoll_info *team_netpoll_info(struct team *team) | |||
833 | } | 834 | } |
834 | 835 | ||
835 | #else | 836 | #else |
836 | static int team_port_enable_netpoll(struct team *team, struct team_port *port) | 837 | static int team_port_enable_netpoll(struct team *team, struct team_port *port, |
838 | gfp_t gfp) | ||
837 | { | 839 | { |
838 | return 0; | 840 | return 0; |
839 | } | 841 | } |
@@ -913,7 +915,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) | |||
913 | } | 915 | } |
914 | 916 | ||
915 | if (team_netpoll_info(team)) { | 917 | if (team_netpoll_info(team)) { |
916 | err = team_port_enable_netpoll(team, port); | 918 | err = team_port_enable_netpoll(team, port, GFP_KERNEL); |
917 | if (err) { | 919 | if (err) { |
918 | netdev_err(dev, "Failed to enable netpoll on device %s\n", | 920 | netdev_err(dev, "Failed to enable netpoll on device %s\n", |
919 | portname); | 921 | portname); |
@@ -1443,7 +1445,7 @@ static void team_netpoll_cleanup(struct net_device *dev) | |||
1443 | } | 1445 | } |
1444 | 1446 | ||
1445 | static int team_netpoll_setup(struct net_device *dev, | 1447 | static int team_netpoll_setup(struct net_device *dev, |
1446 | struct netpoll_info *npifo) | 1448 | struct netpoll_info *npifo, gfp_t gfp) |
1447 | { | 1449 | { |
1448 | struct team *team = netdev_priv(dev); | 1450 | struct team *team = netdev_priv(dev); |
1449 | struct team_port *port; | 1451 | struct team_port *port; |
@@ -1451,7 +1453,7 @@ static int team_netpoll_setup(struct net_device *dev, | |||
1451 | 1453 | ||
1452 | mutex_lock(&team->lock); | 1454 | mutex_lock(&team->lock); |
1453 | list_for_each_entry(port, &team->port_list, list) { | 1455 | list_for_each_entry(port, &team->port_list, list) { |
1454 | err = team_port_enable_netpoll(team, port); | 1456 | err = team_port_enable_netpoll(team, port, gfp); |
1455 | if (err) { | 1457 | if (err) { |
1456 | __team_netpoll_cleanup(team); | 1458 | __team_netpoll_cleanup(team); |
1457 | break; | 1459 | break; |