Displaying 8 results from an estimated 8 matches for "eth_prepare_mac_addr_change".
2016 Dec 06
3
[PATCH] virtio-net: Fix DMA-from-the-stack in virtnet_set_mac_address()
...rs/net/virtio_net.c
@@ -969,12 +969,17 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p)
struct virtnet_info *vi = netdev_priv(dev);
struct virtio_device *vdev = vi->vdev;
int ret;
- struct sockaddr *addr = p;
+ struct sockaddr *addr;
struct scatterlist sg;
- ret = eth_prepare_mac_addr_change(dev, p);
+ addr = kmalloc(sizeof(*addr), GFP_KERNEL);
+ if (!addr)
+ return -ENOMEM;
+ memcpy(addr, p, sizeof(*addr));
+
+ ret = eth_prepare_mac_addr_change(dev, addr);
if (ret)
- return ret;
+ goto out;
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
sg_init_one(&sg, ad...
2016 Dec 06
3
[PATCH] virtio-net: Fix DMA-from-the-stack in virtnet_set_mac_address()
...rs/net/virtio_net.c
@@ -969,12 +969,17 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p)
struct virtnet_info *vi = netdev_priv(dev);
struct virtio_device *vdev = vi->vdev;
int ret;
- struct sockaddr *addr = p;
+ struct sockaddr *addr;
struct scatterlist sg;
- ret = eth_prepare_mac_addr_change(dev, p);
+ addr = kmalloc(sizeof(*addr), GFP_KERNEL);
+ if (!addr)
+ return -ENOMEM;
+ memcpy(addr, p, sizeof(*addr));
+
+ ret = eth_prepare_mac_addr_change(dev, addr);
if (ret)
- return ret;
+ goto out;
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) {
sg_init_one(&sg, ad...
2013 Jan 20
3
[PATCH v4 0/3] make mac programming for virtio net more robust
From: Amos Kong <akong at redhat.com>
Currenly mac is programmed byte by byte. This means that we
have an intermediate step where mac is wrong.
Third patch introduced a new vq control command to set mac
address, it's atomic.
V2: check return of sending command, delay eth_mac_addr()
V3: restore software address when fail to set hardware address
V4: split eth_mac_addr, fix error handle
2013 Jan 20
3
[PATCH v4 0/3] make mac programming for virtio net more robust
From: Amos Kong <akong at redhat.com>
Currenly mac is programmed byte by byte. This means that we
have an intermediate step where mac is wrong.
Third patch introduced a new vq control command to set mac
address, it's atomic.
V2: check return of sending command, delay eth_mac_addr()
V3: restore software address when fail to set hardware address
V4: split eth_mac_addr, fix error handle
2013 Jan 21
4
[PATCH v5 0/3] make mac programming for virtio net more robust
Currenly mac is programmed byte by byte. This means that we
have an intermediate step where mac is wrong.
Third patch introduced a new vq control command to set mac
address, it's atomic.
V2: check return of sending command, delay eth_mac_addr()
V3: restore software address when fail to set hardware address
V4: split eth_mac_addr, fix error handle
V5: rebase patches to net-next tree
Amos
2013 Jan 21
4
[PATCH v5 0/3] make mac programming for virtio net more robust
Currenly mac is programmed byte by byte. This means that we
have an intermediate step where mac is wrong.
Third patch introduced a new vq control command to set mac
address, it's atomic.
V2: check return of sending command, delay eth_mac_addr()
V3: restore software address when fail to set hardware address
V4: split eth_mac_addr, fix error handle
V5: rebase patches to net-next tree
Amos
2016 Dec 23
1
[PATCH] net: Use kmemdup instead of kmalloc and memcpy
...+1206,9 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p)
struct sockaddr *addr;
struct scatterlist sg;
- addr = kmalloc(sizeof(*addr), GFP_KERNEL);
+ addr = kmemdup(p, sizeof(*addr), GFP_KERNEL);
if (!addr)
return -ENOMEM;
- memcpy(addr, p, sizeof(*addr));
ret = eth_prepare_mac_addr_change(dev, addr);
if (ret)
--
2.7.4
2016 Dec 23
1
[PATCH] net: Use kmemdup instead of kmalloc and memcpy
...+1206,9 @@ static int virtnet_set_mac_address(struct net_device *dev, void *p)
struct sockaddr *addr;
struct scatterlist sg;
- addr = kmalloc(sizeof(*addr), GFP_KERNEL);
+ addr = kmemdup(p, sizeof(*addr), GFP_KERNEL);
if (!addr)
return -ENOMEM;
- memcpy(addr, p, sizeof(*addr));
ret = eth_prepare_mac_addr_change(dev, addr);
if (ret)
--
2.7.4