git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bridge: check brport attr show in brport_show
[pandora-kernel.git]
/
net
/
bridge
/
br_sysfs_if.c
diff --git
a/net/bridge/br_sysfs_if.c
b/net/bridge/br_sysfs_if.c
index
fd5799c
..
d1f6604
100644
(file)
--- a/
net/bridge/br_sysfs_if.c
+++ b/
net/bridge/br_sysfs_if.c
@@
-23,7
+23,7
@@
struct brport_attribute {
struct attribute attr;
ssize_t (*show)(struct net_bridge_port *, char *);
struct brport_attribute {
struct attribute attr;
ssize_t (*show)(struct net_bridge_port *, char *);
-
ssize_
t (*store)(struct net_bridge_port *, unsigned long);
+
in
t (*store)(struct net_bridge_port *, unsigned long);
};
#define BRPORT_ATTR(_name,_mode,_show,_store) \
};
#define BRPORT_ATTR(_name,_mode,_show,_store) \
@@
-38,27
+38,17
@@
static ssize_t show_path_cost(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->path_cost);
}
{
return sprintf(buf, "%d\n", p->path_cost);
}
-static ssize_t store_path_cost(struct net_bridge_port *p, unsigned long v)
-{
- br_stp_set_path_cost(p, v);
- return 0;
-}
+
static BRPORT_ATTR(path_cost, S_IRUGO | S_IWUSR,
static BRPORT_ATTR(path_cost, S_IRUGO | S_IWUSR,
- show_path_cost,
store
_path_cost);
+ show_path_cost,
br_stp_set
_path_cost);
static ssize_t show_priority(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->priority);
}
static ssize_t show_priority(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->priority);
}
-static ssize_t store_priority(struct net_bridge_port *p, unsigned long v)
-{
- if (v >= (1<<(16-BR_PORT_BITS)))
- return -ERANGE;
- br_stp_set_port_priority(p, v);
- return 0;
-}
+
static BRPORT_ATTR(priority, S_IRUGO | S_IWUSR,
static BRPORT_ATTR(priority, S_IRUGO | S_IWUSR,
- show_priority,
store
_priority);
+ show_priority,
br_stp_set_port
_priority);
static ssize_t show_designated_root(struct net_bridge_port *p, char *buf)
{
static ssize_t show_designated_root(struct net_bridge_port *p, char *buf)
{
@@
-136,7
+126,7
@@
static ssize_t show_hold_timer(struct net_bridge_port *p,
}
static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
}
static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
-static
ssize_
t store_flush(struct net_bridge_port *p, unsigned long v)
+static
in
t store_flush(struct net_bridge_port *p, unsigned long v)
{
br_fdb_delete_by_port(p->br, p, 0); // Don't delete local entry
return 0;
{
br_fdb_delete_by_port(p->br, p, 0); // Don't delete local entry
return 0;
@@
-148,7
+138,7
@@
static ssize_t show_hairpin_mode(struct net_bridge_port *p, char *buf)
int hairpin_mode = (p->flags & BR_HAIRPIN_MODE) ? 1 : 0;
return sprintf(buf, "%d\n", hairpin_mode);
}
int hairpin_mode = (p->flags & BR_HAIRPIN_MODE) ? 1 : 0;
return sprintf(buf, "%d\n", hairpin_mode);
}
-static
ssize_
t store_hairpin_mode(struct net_bridge_port *p, unsigned long v)
+static
in
t store_hairpin_mode(struct net_bridge_port *p, unsigned long v)
{
if (v)
p->flags |= BR_HAIRPIN_MODE;
{
if (v)
p->flags |= BR_HAIRPIN_MODE;
@@
-165,7
+155,7
@@
static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
return sprintf(buf, "%d\n", p->multicast_router);
}
return sprintf(buf, "%d\n", p->multicast_router);
}
-static
ssize_
t store_multicast_router(struct net_bridge_port *p,
+static
in
t store_multicast_router(struct net_bridge_port *p,
unsigned long v)
{
return br_multicast_set_port_router(p, v);
unsigned long v)
{
return br_multicast_set_port_router(p, v);
@@
-206,6
+196,9
@@
static ssize_t brport_show(struct kobject * kobj,
struct brport_attribute * brport_attr = to_brport_attr(attr);
struct net_bridge_port * p = to_brport(kobj);
struct brport_attribute * brport_attr = to_brport_attr(attr);
struct net_bridge_port * p = to_brport(kobj);
+ if (!brport_attr->show)
+ return -EINVAL;
+
return brport_attr->show(p, buf);
}
return brport_attr->show(p, buf);
}