summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* rxrpc: Make /proc/net/rxrpc_calls saferDavid Howells2016-08-244-9/+26
| | | | | | | | | | Make /proc/net/rxrpc_calls safer by stashing a copy of the peer pointer in the rxrpc_call struct and checking in the show routine that the peer pointer, the socket pointer and the local pointer obtained from the socket pointer aren't NULL before we use them. Signed-off-by: David Howells <dhowells@redhat.com>
* rxrpc: Fix conn-based retransmitDavid Howells2016-08-242-1/+2
| | | | | | | | | | | | | | | If a duplicate packet comes in for a call that has just completed on a connection's channel then there will be an oops in the data_ready handler because it tries to examine the connection struct via a call struct (which we don't have - the pointer is unset). Since the connection struct pointer is available to us, go direct instead. Also, the ACK packet to be retransmitted needs three octets of padding between the soft ack list and the ackinfo. Fixes: 18bfeba50dfd0c8ee420396f2570f16a0bdbd7de ("rxrpc: Perform terminal call ACK/ABORT retransmission from conn processor") Signed-off-by: David Howells <dhowells@redhat.com>
* net: diag: support SOCK_DESTROY for UDP socketsDavid Ahern2016-08-243-0/+95
| | | | | | | | | | This implements SOCK_DESTROY for UDP sockets similar to what was done for TCP with commit c1e64e298b8ca ("net: diag: Support destroying TCP sockets.") A process with a UDP socket targeted for destroy is awakened and recvmsg fails with ECONNABORTED. Signed-off-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* tipc: use kfree_skb() instead of kfree()Wei Yongjun2016-08-241-1/+1
| | | | | | | | | Use kfree_skb() instead of kfree() to free sk_buff. Fixes: 0d051bf93c06 ("tipc: make bearer packet filtering generic") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge tag 'rxrpc-rewrite-20160823-2' of ↵David S. Miller2016-08-247-62/+226
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs David Howells says: ==================== rxrpc: Miscellaneous improvements Here are some improvements that are part of the AF_RXRPC rewrite. They need to be applied on top of the just posted cleanups. (1) Set the connection expiry on the connection becoming idle when its last currently active call completes rather than each time put is called. This means that the connection isn't held open by retransmissions, pings and duplicate packets. Future patches will limit the number of live connections that the kernel will support, so making sure that old connections don't overstay their welcome is necessary. (2) Calculate packet serial skew in the UDP data_ready callback rather than in the call processor on a work queue. Deferring it like this causes the skew to be elevated by further packets coming in before we get to make the calculation. (3) Move retransmission of the terminal ACK or ABORT packet for a connection to the connection processor, using the terminal state cached in the rxrpc_connection struct. This means that once last_call is set in a channel to the current call's ID, no more packets will be routed to that rxrpc_call struct. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * rxrpc: Perform terminal call ACK/ABORT retransmission from conn processorDavid Howells2016-08-234-4/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Perform terminal call ACK/ABORT retransmission in the connection processor rather than in the call processor. With this change, once last_call is set, no more incoming packets will be routed to the corresponding call or any earlier calls on that channel (call IDs must only increase on a channel on a connection). Further, if a packet's callNumber is before the last_call ID or a packet is aimed at successfully completed service call then that packet is discarded and ignored. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: Calculate serial skew on packet receptionDavid Howells2016-08-235-31/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calculate the serial number skew in the data_ready handler when a packet has been received and a connection looked up. The skew is cached in the sk_buff's priority field. The connection highest received serial number is updated at this time also. This can be done without locks or atomic instructions because, at this point, the code is serialised by the socket. This generates more accurate skew data because if the packet is offloaded to a work queue before this is determined, more packets may come in, bumping the highest serial number and thereby increasing the apparent skew. This also removes some unnecessary atomic ops. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: Set connection expiry on idle, not putDavid Howells2016-08-232-27/+26Star
| | | | | | | | | | | | | | | | | | | | | | | | Set the connection expiry time when a connection becomes idle rather than doing this in rxrpc_put_connection(). This makes the put path more efficient (it is likely to be called occasionally whilst a connection has outstanding calls because active workqueue items needs to be given a ref). The time is also preset in the connection allocator in case the connection never gets used. Signed-off-by: David Howells <dhowells@redhat.com>
* | Merge tag 'rxrpc-rewrite-20160823-1' of ↵David S. Miller2016-08-2414-80/+113
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs David Howells says: ==================== rxrpc: Cleanups Here are some cleanups for the AF_RXRPC rewrite: (1) Remove some unused bits. (2) Call releasing on socket closure is now done in the order in which calls progress through the phases so that we don't miss a call actively moving list. (3) The rxrpc_call struct's channel number field is redundant and replaced with accesses to the masked off cid field instead. (4) Use a tracepoint for socket buffer accounting rather than printks. Unfortunately, since this would require currently non-existend arch-specific help to divine the current instruction location, the accounting functions are moved out of line so that __builtin_return_address() can be used. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * rxrpc: Use a tracepoint for skb accounting debuggingDavid Howells2016-08-239-38/+79
| | | | | | | | | | | | | | Use a tracepoint to log various skb accounting points to help in debugging refcounting errors. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: Drop channel number field from rxrpc_call structDavid Howells2016-08-235-10/+8Star
| | | | | | | | | | | | | | | | | | Drop the channel number (channel) field from the rxrpc_call struct to reduce the size of the call struct. The field is redundant: if the call is attached to a connection, the channel can be obtained from there by AND'ing with RXRPC_CHANNELMASK. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: When clearing a socket, clear the call sets in the right orderDavid Howells2016-08-231-6/+6
| | | | | | | | | | | | | | | | | | | | When clearing a socket, we should clear the securing-in-progress list first, then the accept queue and last the main call tree because that's the order in which a call progresses. Not that a call should move from the accept queue to the main tree whilst we're shutting down a socket, but it a call could possibly move from sequreq to acceptq whilst we're clearing up. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: Tidy up the rxrpc_call struct a bitDavid Howells2016-08-235-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do a little tidying of the rxrpc_call struct: (1) in_clientflag is no longer compared against the value that's in the packet, so keeping it in this form isn't necessary. Use a flag in flags instead and provide a pair of wrapper functions. (2) We don't read the epoch value, so that can go. (3) Move what remains of the data that were used for hashing up in the struct to be with the channel number. (4) Get rid of the local pointer. We can get at this via the socket struct and we only use this in the procfs viewer. Signed-off-by: David Howells <dhowells@redhat.com>
| * rxrpc: Remove RXRPC_CALL_PROC_BUSYDavid Howells2016-08-232-7/+0Star
| | | | | | | | | | | | Remove RXRPC_CALL_PROC_BUSY as work queue items are now 100% non-reentrant. Signed-off-by: David Howells <dhowells@redhat.com>
* | net: rtnetlink: Don't export empty RTAX_FEATURESPhil Sutter2016-08-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since the features bit field has bits for internal only use as well, it may happen that the kernel exports RTAX_FEATURES attribute with zero value which is pointless. Fix this by making sure the attribute is added only if the exported value is non-zero. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net-tcp: retire TFO_SERVER_WO_SOCKOPT2 configYuchung Cheng2016-08-241-13/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | TFO_SERVER_WO_SOCKOPT2 was intended for debugging purposes during Fast Open development. Remove this config option and also update/clean-up the documentation of the Fast Open sysctl. Reported-by: Piotr Jurkiewicz <piotr.jerzy.jurkiewicz@gmail.com> Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | l2tp: Refactor the codes with existing macros instead of literal numberGao Feng2016-08-241-11/+9Star
| | | | | | | | | | | | | | | | | | Use PPP_ALLSTATIONS, PPP_UI, and SEND_SHUTDOWN instead of 0xff, 0x03, and 2 separately. Signed-off-by: Gao Feng <fgao@ikuai8.com> Acked-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
* | kcm: Fix locking issueTom Herbert2016-08-242-10/+23
| | | | | | | | | | | | | | | | | | | | Lock the lower socket in kcm_unattach. Release during call to strp_done since that function cancels the RX timers and work queue with sync. Also added some status information in psock reporting. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | strparser: Queue work when being unpausedTom Herbert2016-08-241-0/+11
|/ | | | | | | | When the upper layer unpauses a stream parser connection we need to queue rx_work to make sure no events are missed. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: strparser: fix strparser sk_user_data checkDave Watson2016-08-231-3/+0Star
| | | | | | | | | | | | sk_user_data mismatch between what kcm expects (psock) and what strparser expects (strparser). Queued rx_work, for example calling strp_check_rcv after socket buffer changes, will never complete. sk_user_data is unused in strparser, so just remove the check. Signed-off-by: Dave Watson <davejwatson@fb.com> Acked-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: dsa: Allow the DSA driver to indicate the tag protocolAndrew Lunn2016-08-232-2/+7
| | | | | | | | | | DSA drivers may drive different families of switches which need different tag protocol. Rather than hard code the tag protocol in the driver structure, have a callback for the DSA core to call. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ipconfig: Fix NULL pointer dereference on RARP/BOOTP/DHCP timeoutGeert Uytterhoeven2016-08-231-1/+1
| | | | | | | | | | | | | | | If no RARP, BOOTP, or DHCP response is received, ic_dev is never set, causing a NULL pointer dereference in ic_close_devs(): Sending DHCP requests ...... timed out! Unable to handle kernel NULL pointer dereference at virtual address 00000004 To fix this, add a check to avoid dereferencing ic_dev if it is still NULL. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Fixes: 2647cffb2bc6fbed ("net: ipconfig: Support using "delayed" DHCP replies") Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge tag 'batadv-next-for-davem-20160822' of ↵David S. Miller2016-08-2320-37/+131
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.open-mesh.org/linux-merge Simon Wunderlich says: ==================== This feature patchset includes the following changes: - place kref_get near usage of referenced objects, separate patches for various used objects to improve readability and maintainability by Sven Eckelmann (18 patches) - Keep batadv net device when all hard interfaces disappear, to improve situations where tools currently use work arounds, by Sven Eckelmann - Add an option to disable debugfs support to minimize footprint when userspace uses netlink only, by Sven Eckelmann ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * batman-adv: Allow to disable debugfs supportSven Eckelmann2016-08-0916-6/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The files provided by batman-adv via debugfs are currently converted to netlink. Tools which are not yet converted to use the netlink interface may still rely on the old debugfs files. But systems which already upgraded their tools can save some space by disabling this feature. The default configuration of batman-adv on amd64 can reduce the size of the module by around 11% when this feature is disabled. $ size net/batman-adv/batman-adv.ko* text data bss dec hex filename 150507 10395 4160 165062 284c6 net/batman-adv/batman-adv.ko.y 137106 7099 2112 146317 23b8d net/batman-adv/batman-adv.ko.n Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Keep batadv netdev when hardif disappearsSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch-like virtual interfaces like bridge or openvswitch don't destroy itself when all their attached netdevices dissappear. Instead they only remove the link to the unregistered device and keep working until they get removed manually. This has the benefit that all configurations for this interfaces are kept and daemons reacting to rtnl events can just add new slave interfaces without going through the complete configuration of the switch-like netdevice. Handling unregister events of client devices similar in batman-adv allows users to drop their current workaround of dummy netdevices attached to batman-adv soft-interfaces. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for tvlv_handler near useSven Eckelmann2016-08-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for tvlv_container near useSven Eckelmann2016-08-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for nc_path near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for nc_node near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for softif_vlan near useSven Eckelmann2016-08-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for hard_iface near useSven Eckelmann2016-08-091-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for gw_node near useSven Eckelmann2016-08-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for dat_entry near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for bla_backbone_gw near useSven Eckelmann2016-08-091-3/+1Star
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for bla_claim near useSven Eckelmann2016-08-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for tt_common near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for tt_local_entry near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for orig_node near useSven Eckelmann2016-08-095-12/+10Star
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for neigh_node near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for neigh_ifinfo near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for tt_orig_list_entry near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for orig_ifinfo near useSven Eckelmann2016-08-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
| * batman-adv: Place kref_get for orig_node_vlan near useSven Eckelmann2016-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | It is hard to understand why the refcnt is increased when it isn't done near the actual place the new reference is used. So using kref_get right before the place which requires the reference and in the same function helps to avoid accidental problems caused by incorrect reference counting. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
* | net_sched: properly handle failure case of tcf_exts_init()WANG Cong2016-08-2310-72/+177
| | | | | | | | | | | | | | | | | | | | | | | | After commit 22dc13c837c3 ("net_sched: convert tcf_exts from list to pointer array") we do dynamic allocation in tcf_exts_init(), therefore we need to handle the ENOMEM case properly. Cc: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | Revert "l2tp: Refactor the codes with existing macros instead of literal number"David S. Miller2016-08-221-4/+4
| | | | | | | | | | | | | | | | This reverts commit 5ab1fe72d5490978104fc493615ea29dd7238766. This change still has problems. Signed-off-by: David S. Miller <davem@davemloft.net>
* | l2tp: Refactor the codes with existing macros instead of literal numberGao Feng2016-08-221-4/+4
| | | | | | | | | | | | | | | | Use PPP_ALLSTATIONS, PPP_UI, and SEND_SHUTDOWN instead of 0xff, 0x03, and 2 separately. Signed-off-by: Gao Feng <fgao@ikuai8.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net/irda: remove pointless assignment/checkVegard Nossum2016-08-201-3/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We've already set sk to sock->sk and dereferenced it, so if it's NULL we would have crashed already. Moreover, if it was NULL we would have crashed anyway when jumping to 'out' and trying to unlock the sock. Furthermore, if we had assigned a different value to 'sk' we would have been calling lock_sock() and release_sock() on different sockets. My conclusion is that these two lines are complete nonsense and only serve to confuse the reader. Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: dsa: bcm_sf2: Make it a real platform device driverFlorian Fainelli2016-08-201-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | The Broadcom Starfighter 2 switch driver should be a proper platform driver, now that the DSA code has been updated to allow that, register a switch device, feed it with the proper configuration data coming from Device Tree and register our switch device with DSA. The bulk of the changes consist in moving what bcm_sf2_sw_setup() did into the platform driver probe function. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: dsa: Export suspend/resume functionsFlorian Fainelli2016-08-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | In preparation for allowing switch drivers to implement system-wide suspend/resume functions, export dsa_switch_suspend and dsa_switch_resume() such that these are callable from the appropriate driver specific suspend/resume functions. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* | net: ipv4: fix sparse error in fib_good_nh()Eric Dumazet2016-08-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following sparse errors : net/ipv4/fib_semantics.c:1579:61: warning: incorrect type in argument 2 (different base types) net/ipv4/fib_semantics.c:1579:61: expected unsigned int [unsigned] [usertype] key net/ipv4/fib_semantics.c:1579:61: got restricted __be32 const [usertype] nh_gw Fixes: a6db4494d218c ("net: ipv4: Consider failed nexthops in multipath routes") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>