Changeset 21846


Ignore:
Timestamp:
2010-06-20T07:42:38+02:00 (7 years ago)
Author:
juhosg
Message:

backfire: [kernel] swconfig: Check vlan/port indexes for validity. (backport of r20811)

Swconfig needs to make sure that requested vlans/ports actually exist,
else it might read or modify memory not belonging to itself.

This patch adds a quick range check in swconfig's kernel part to
prevent accidential or intentional memory modification.

Signed-off-by: Jonas Gorski <jonas.gorski+openwrt@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/backfire/target/linux/generic-2.6/files/drivers/net/phy/swconfig.c

    r21782 r21846  
    464464                        goto done; 
    465465                val->port_vlan = nla_get_u32(info->attrs[SWITCH_ATTR_OP_VLAN]); 
     466                if (val->port_vlan >= dev->vlans) 
     467                        goto done; 
    466468                break; 
    467469        case SWITCH_CMD_SET_PORT: 
     
    474476                        goto done; 
    475477                val->port_vlan = nla_get_u32(info->attrs[SWITCH_ATTR_OP_PORT]); 
     478                if (val->port_vlan >= dev->ports) 
     479                        goto done; 
    476480                break; 
    477481        default: 
Note: See TracChangeset for help on using the changeset viewer.