Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a159aaa328a02b0189774c58ae7d917b25d26852
Commit:     a159aaa328a02b0189774c58ae7d917b25d26852
Parent:     a4282717c102aef2bfab1d947c392de4d8abc0ec
Author:     Ralf Baechle <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 14 15:51:44 2006 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sun Dec 17 21:59:13 2006 -0800

    [AX.25]: Fix unchecked rose_add_loopback_node uses
    
    Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/rose/rose_dev.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 7c279e2..50824d3 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -93,20 +93,34 @@ static int rose_rebuild_header(struct sk_buff *skb)
 static int rose_set_mac_address(struct net_device *dev, void *addr)
 {
        struct sockaddr *sa = addr;
+       int err;
 
-       rose_del_loopback_node((rose_address *)dev->dev_addr);
+       if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len))
+               return 0;
 
-       memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
+       if (dev->flags & IFF_UP) {
+               err = rose_add_loopback_node((rose_address *)dev->dev_addr);
+               if (err)
+                       return err;
+
+               rose_del_loopback_node((rose_address *)dev->dev_addr);
+       }
 
-       rose_add_loopback_node((rose_address *)dev->dev_addr);
+       memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
 
        return 0;
 }
 
 static int rose_open(struct net_device *dev)
 {
+       int err;
+
+       err = rose_add_loopback_node((rose_address *)dev->dev_addr);
+       if (err)
+               return err;
+
        netif_start_queue(dev);
-       rose_add_loopback_node((rose_address *)dev->dev_addr);
+
        return 0;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to