05 Sep, 2018
1 commit
-
[ Upstream commit 64119e05f7b31e83e2555f6782e6cdc8f81c63f4 ]
Add a missing rcu_read_unlock in the error path
Fixes: c95567c80352 ("caif: added check for potential null return")
Signed-off-by: YueHaibing
Signed-off-by: David S. Miller
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
18 Nov, 2016
1 commit
-
Make struct pernet_operations::id unsigned.
There are 2 reasons to do so:
1)
This field is really an index into an zero based array and
thus is unsigned entity. Using negative value is out-of-bound
access by definition.2)
On x86_64 unsigned 32-bit data which are mixed with pointers
via array indexing or offsets added or subtracted to pointers
are preffered to signed 32-bit data."int" being used as an array index needs to be sign-extended
to 64-bit before being used.void f(long *p, int i)
{
g(p[i]);
}roughly translates to
movsx rsi, esi
mov rdi, [rsi+...]
call gMOVSX is 3 byte instruction which isn't necessary if the variable is
unsigned because x86_64 is zero extending by default.Now, there is net_generic() function which, you guessed it right, uses
"int" as an array index:static inline void *net_generic(const struct net *net, int id)
{
...
ptr = ng->ptr[id - 1];
...
}And this function is used a lot, so those sign extensions add up.
Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
messing with code generation):add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
Unfortunately some functions actually grow bigger.
This is a semmingly random artefact of code generation with register
allocator being used differently. gcc decides that some variable
needs to live in new r8+ registers and every access now requires REX
prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
used which is longer than [r8]However, overall balance is in negative direction:
add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
function old new delta
nfsd4_lock 3886 3959 +73
tipc_link_build_proto_msg 1096 1140 +44
mac80211_hwsim_new_radio 2776 2808 +32
tipc_mon_rcv 1032 1058 +26
svcauth_gss_legacy_init 1413 1429 +16
tipc_bcbase_select_primary 379 392 +13
nfsd4_exchange_id 1247 1260 +13
nfsd4_setclientid_confirm 782 793 +11
...
put_client_renew_locked 494 480 -14
ip_set_sockfn_get 730 716 -14
geneve_sock_add 829 813 -16
nfsd4_sequence_done 721 703 -18
nlmclnt_lookup_host 708 686 -22
nfsd4_lockt 1085 1063 -22
nfs_get_client 1077 1050 -27
tcf_bpf_init 1106 1076 -30
nfsd4_encode_fattr 5997 5930 -67
Total: Before=154856051, After=154854321, chg -0.00%Signed-off-by: Alexey Dobriyan
Signed-off-by: David S. Miller
19 Aug, 2015
1 commit
-
Signed-off-by: Phil Sutter
Cc: Dmitry Tarnyagin
Signed-off-by: David S. Miller
10 Feb, 2014
1 commit
-
Include appropriate header file net/caif/caif_dev.h in caif/caif_dev.c
because it has prototype declarations of function defined in
caif/caif_dev.c.This eliminates the following file in caif/caif_dev.c:
net/caif/caif_dev.c:303:6: warning: no previous prototype for ‘caif_enroll_dev’ [-Wmissing-prototypes]Signed-off-by: Rashika Kheria
Reviewed-by: Josh Triplett
Signed-off-by: David S. Miller
29 May, 2013
1 commit
-
So far, only net_device * could be passed along with netdevice notifier
event. This patch provides a possibility to pass custom structure
able to provide info that event listener needs to know.Signed-off-by: Jiri Pirko
v2->v3: fix typo on simeth
shortened dev_getter
shortened notifier_info struct name
v1->v2: fix notifier_call parameter in call_netdevice_notifier()
Signed-off-by: David S. Miller
24 Apr, 2013
1 commit
-
Remove my soon bouncing email address.
Also remove the "Contact:" line in file header.
The MAINTAINERS file is a better place to find the
contact person anyway.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
08 Mar, 2013
1 commit
-
This lines up function arguments on second and subsequent lines at the
first column after the openning parenthesis of the first line.Signed-off-by: Silviu-Mihai Popescu
Signed-off-by: David S. Miller
03 Mar, 2013
1 commit
-
This fixed the following sparse warning:
net/caif/caif_dev.c:121:6: warning: symbol 'caif_flow_cb' was not
declared. Should it be static?Signed-off-by: Silviu-Mihai Popescu
Signed-off-by: David S. Miller
20 Jul, 2012
1 commit
-
Conflicts:
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
17 Jul, 2012
1 commit
-
unregister_netdevice_notifier() must be called before
unregister_pernet_subsys() to avoid accessing already freed
pernet memory. This fixes the following oops when doing rmmod:Call Trace:
[] caif_device_notify+0x4d/0x5a0 [caif]
[] unregister_netdevice_notifier+0xb9/0x100
[] caif_device_exit+0x1c/0x250 [caif]
[] sys_delete_module+0x1a4/0x300
[] ? trace_hardirqs_on_caller+0x15d/0x1e0
[] ? trace_hardirqs_on_thunk+0x3a/0x3
[] system_call_fastpath+0x1a/0x1fRIP
[] caif_get+0x51/0xb0 [caif]Signed-off-by: Sjur Brændeland
Acked-by: "Eric W. Biederman"
Signed-off-by: David S. Miller
26 Jun, 2012
2 commits
-
Add check on NULL return from caif_get().
Signed-off-by: Kim Lilliestierna
Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
Removed surplus call to caif_device_list() in caif_dev.c
Signed-off-by: Kim Lilliestierna
Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
18 Jun, 2012
1 commit
-
Signed-off-by: Rémi Denis-Courmont
Cc: Sakari Ailus
Signed-off-by: David S. Miller
06 Feb, 2012
1 commit
-
Signed-off-by: Jesper Juhl
Signed-off-by: David S. Miller
28 Jan, 2012
1 commit
-
caif is a subsystem and as such it needs to register with
register_pernet_subsys instead of register_pernet_device.Among other problems using register_pernet_device was resulting in
net_generic being called before the caif_net structure was allocated.
Which has been causing net_generic to fail with either BUG_ON's or by
return NULL pointers.A more ugly problem that could be caused is packets in flight why the
subsystem is shutting down.To remove confusion also remove the cruft cause by inappropriately
trying to fix this bug.With the aid of the previous patch I have tested this patch and
confirmed that using register_pernet_subsys makes the failure go away as
it should.Signed-off-by: Eric W. Biederman
Acked-by: Sjur Brændeland
Tested-by: Sasha Levin
Signed-off-by: David S. Miller
17 Jan, 2012
1 commit
-
Remove WARN_ON and bad handling of SKB without destructor callback
in caif_flow_cb. SKB without destructor cannot be handled as an
error case.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
10 Jan, 2012
1 commit
-
* 'for-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu:
percpu: Remove irqsafe_cpu_xxx variantsFix up conflict in arch/x86/include/asm/percpu.h due to clash with
cebef5beed3d ("x86: Fix and improve percpu_cmpxchg{8,16}b_double()")
which edited the (now removed) irqsafe_cpu_cmpxchg*_double code.
23 Dec, 2011
1 commit
-
We simply say that regular this_cpu use must be safe regardless of
preemption and interrupt state. That has no material change for x86
and s390 implementations of this_cpu operations. However, arches that
do not provide their own implementation for this_cpu operations will
now get code generated that disables interrupts instead of preemption.-tj: This is part of on-going percpu API cleanup. For detailed
discussion of the subject, please refer to the following thread.http://thread.gmane.org/gmane.linux.kernel/1222078
Signed-off-by: Christoph Lameter
Signed-off-by: Tejun Heo
LKML-Reference:
07 Dec, 2011
1 commit
-
BUG_ON is too strict in a number of circumstances,
use WARN_ON instead. Protocol errors should not halt the system.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
06 Dec, 2011
3 commits
-
This patch adds functionality for avoiding orphaning SKB too early.
The original skb is stashed away and the original destructor is called
from the hi-jacked flow-on callback. If CAIF interface goes down and a
hi-jacked SKB exists, the original skb->destructor is restored.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
Flow control is implemented by inspecting the qdisc queue length
in order to detect potential overflow on the TX queue. When a threshold
is reached flow-off is sent upwards in the CAIF stack. At the same time
the skb->destructor is hi-jacked by orphaning the SKB and the original
destructor is replaced with a "flow-on" callback. When the "hi-jacked"
SKB is consumed the queue should be empty, and the "flow-on" callback
is called and xon is sent upwards in the CAIF stack.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
NCM 1.0 does not support anything but Ethernet framing, hence
CAIF payload will be put into Ethernet frames.Discovery is based on fixed USB vendor 0x04cc (ST-Ericsson),
product-id 0x230f (NCM). In this variant only CAIF payload is sent over
the NCM interface.The CAIF stack (cfusbl.c) will when USB interface register first check if
we got a CDC NCM USB interface with the right VID, PID.
It will then read the device's Ethernet address and create a 'template'
Ethernet TX header, using a broadcast address as the destination address,
and EthType 0x88b5 (802.1 Local Experimental - vendor specific).A protocol handler for 0x88b5 is setup for reception of CAIF frames from
the CDC NCM USB interface.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
01 Dec, 2011
2 commits
-
Remove unused enum cfcnfg_phy_type and the parameter to cfserl_create.
Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
Enrolling CAIF link layers are refactored.
Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
01 Nov, 2011
1 commit
-
With calls to modular infrastructure, these files really
needs the full module.h header. Call it out so some of the
cleanups of implicit and unrequired includes elsewhere can be
cleaned up.Signed-off-by: Paul Gortmaker
26 Oct, 2011
1 commit
-
The caif code will register its own pernet_operations, and then register
a netdevice_notifier. Each time the netdevice_notifier is triggered,
it'll do some stuff... including a lookup of its own pernet stuff with
net_generic().If the net_generic() call ever returns NULL, the caif code will BUG().
That doesn't seem *so* unreasonable, I suppose — it does seem like it
should never happen.However, it *does* happen. When we clone a network namespace,
setup_net() runs through all the pernet_operations one at a time. It
gets to loopback before it gets to caif. And loopback_net_init()
registers a netdevice... while caif hasn't been initialised. So the caif
netdevice notifier triggers, and immediately goes BUG().We could imagine a complex and overengineered solution to this generic
class of problems, but this patch takes the simple approach. It just
makes caif_device_notify() *not* go looking for its pernet data
structures if the device it's being notified about isn't a caif device
in the first place.Cc: stable@kernel.org
Signed-off-by: David Woodhouse
Acked-by: Sjur Brændeland
Signed-off-by: David S. Miller
17 Sep, 2011
1 commit
-
Commit bd30ce4bc0b7 (caif: Use RCU instead of spin-lock in caif_dev.c)
added a potential NULL dereference in case alloc_percpu() fails.caif_device_alloc() can also use GFP_KERNEL instead of GFP_ATOMIC.
Signed-off-by: Eric Dumazet
CC: Sjur Brændeland
Acked-by: Sjur Brændeland
Signed-off-by: David S. Miller
22 Jun, 2011
1 commit
-
It was suggested by "make versioncheck" that the follwing includes of
linux/version.h are redundant:/home/jj/src/linux-2.6/net/caif/caif_dev.c: 14 linux/version.h not needed.
/home/jj/src/linux-2.6/net/caif/chnl_net.c: 10 linux/version.h not needed.
/home/jj/src/linux-2.6/net/ipv4/gre.c: 19 linux/version.h not needed.
/home/jj/src/linux-2.6/net/netfilter/ipset/ip_set_core.c: 20 linux/version.h not needed.
/home/jj/src/linux-2.6/net/netfilter/xt_set.c: 16 linux/version.h not needed.and it seems that it is right.
Beyond manually inspecting the source files I also did a few build
tests with various configs to confirm that including the header in
those files is indeed not needed.Here's a patch to remove the pointless includes.
Signed-off-by: Jesper Juhl
Acked-by: Jozsef Kadlecsik
Signed-off-by: David S. Miller
23 May, 2011
1 commit
-
In case of checksum error, the framing layer returns -EILSEQ, but
does not free the packet. Plug this hole by freeing the packet if
-EILSEQ is returned.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
16 May, 2011
3 commits
-
Do proper handling of dev_queue_xmit errors in order to
avoid double free of skb and leaks in error conditions.
In cfctrl pending requests are removed when CAIF Link layer goes down.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
Use struct net to reference CAIF configuration object instead of static variables.
Refactor functions caif_connect_client, caif_disconnect_client and squach
files cfcnfg.c and caif_config_utils.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
RCU read_lock and refcount is used to protect in-flight packets.
Use RCU and counters to manage freeing lower part of the CAIF stack if
CAIF-link layer is removed. Old solution based on delaying removal of
device is removed.When CAIF link layer goes down the use of CAIF link layer is disabled
(by calling caif_set_phy_state()), but removal and freeing of the
lower part of the CAIF stack is done when Link layer is unregistered.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller
18 Apr, 2011
1 commit
-
The variable 'caifdef' is set but unused in modemcmd().
Similarly for 'net' in receive(), and 'res' in
caif_device_notify() and caif_exit_net().Just kill them off.
Signed-off-by: David S. Miller
12 Apr, 2011
2 commits
-
If CAIF Link Layer returns an error, we no longer try to re-build the
CAIF packet and resend it. Instead, we simply return any transmission
errors to the socket client.Signed-off-by: Sjur Brændeland
Signed-off-by: David S. Miller -
Cleanup of new CAIF code.
* make local functions static
* remove code that is never used
* expand get_caif_conf() since wrapper is no longer needed
* make args to comparison functions const
* rename connect_req_to_link_param to keep exported names
consistentCompile tested only.
Signed-off-by: Stephen Hemminger
Acked-by: Sjur Brændeland
Signed-off-by: David S. Miller
04 Nov, 2010
1 commit
-
Changes:
o Bugfix: SO_PRIORITY for SOL_SOCKET could not be handled
in caif's setsockopt, using the struct sock attribute priority instead.o Bugfix: SO_BINDTODEVICE for SOL_SOCKET could not be handled
in caif's setsockopt, using the struct sock attribute ifindex instead.o Wrong assert statement for RFM layer segmentation.
o CAIF Debug channels was not working over SPI, caif_payload_info
containing padding info must be initialized.o Check on pointer before dereferencing when unregister dev in caif_dev.c
Signed-off-by: Sjur Braendeland
Signed-off-by: David S. Miller
22 Sep, 2010
1 commit
-
Check that receive function pointer is not null before calling it.
Signed-off-by: Sjur Braendeland
Signed-off-by: David S. Miller
07 Sep, 2010
2 commits
-
Convert pr_("%s" ..., (struct netdev *)->name ...)
to netdev_((struct netdev *), ...)Signed-off-by: Joe Perches
Signed-off-by: David S. Miller -
This patch standardizes caif message logging prefixes.
Add #define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
Add missing "\n"s to some logging messages
Convert pr_warning to pr_warnThis changes the logging message prefix from CAIF: to caif:
for all uses but caif_socket.c and chnl_net.c. Those now use
their filename without extension.Signed-off-by: Joe Perches
Signed-off-by: David S. Miller
21 Jun, 2010
1 commit
-
Previously CAIF supported maximum transfer size of ~4050.
The transfer size is now calculated dynamically based on the
link layers mtu size.Signed-off-by: Sjur Braendeland@stericsson.com
Signed-off-by: David S. Miller