Skip to content

Commit a77f5db

Browse files
Ben Hutchingsdavem330
authored andcommitted
ethtool: Allocate register dump buffer with vmalloc()
Some NICs have huge register files which exceed the maximum heap allocation size. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6099e3d commit a77f5db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
815815
if (regs.len > reglen)
816816
regs.len = reglen;
817817

818-
regbuf = kmalloc(reglen, GFP_USER);
818+
regbuf = vmalloc(reglen);
819819
if (!regbuf)
820820
return -ENOMEM;
821821

@@ -830,7 +830,7 @@ static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
830830
ret = 0;
831831

832832
out:
833-
kfree(regbuf);
833+
vfree(regbuf);
834834
return ret;
835835
}
836836

0 commit comments

Comments
 (0)