summaryrefslogtreecommitdiff
path: root/dev.h
blob: cebcee4877d5556f90ff4b541062e0d43fa7852e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#ifndef DEV_H
#define DEV_H

#include <sys/socket.h>
#include "built_in.h"

extern int device_mtu(const char *ifname);
extern int device_address(const char *ifname, int af, struct sockaddr_storage *ss);
extern int device_ifindex(const char *ifname);
extern short device_get_flags(const char *ifname);
extern void device_set_flags(const char *ifname, const short flags);
extern int device_up_and_running(char *ifname);
extern u32 device_bitrate(const char *ifname);

#endif /* DEV_H */
h>committerDavid S. Miller <davem@davemloft.net>2016-11-28 16:15:45 -0500 commit7a99cd6e213685b78118382e6a8fed506c82ccb2 (patch) treef08b04e49d5002be5dcee747fe5b91b0eb112ef7 parent79dc7e3f1cd323be4c81aa1a94faa1b3ed987fb2 (diff)
net: dsa: fix unbalanced dsa_switch_tree reference counting
_dsa_register_switch() gets a dsa_switch_tree object either via dsa_get_dst() or via dsa_add_dst(). Former path does not increase kref in returned object (resulting into caller not owning a reference), while later path does create a new object (resulting into caller owning a reference). The rest of _dsa_register_switch() assumes that it owns a reference, and calls dsa_put_dst(). This causes a memory breakage if first switch in the tree initialized successfully, but second failed to initialize. In particular, freed dsa_swith_tree object is left referenced by switch that was initialized, and later access to sysfs attributes of that switch cause OOPS. To fix, need to add kref_get() call to dsa_get_dst(). Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation") Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat