The linux-next commit "inet: fix various use-after-free in defrags
units" [1] introduced compilation warnings,
./include/net/inet_frag.h:117:1: warning: 'inline' is not at beginning
of declaration [-Wold-style-declaration]
static void inline fqdir_pre_exit(struct fqdir *fqdir)
^~~~~~
In file included from ./include/net/netns/ipv4.h:10,
from ./include/net/net_namespace.h:20,
from ./include/linux/netdevice.h:38,
from ./include/linux/icmpv6.h:13,
from ./include/linux/ipv6.h:86,
from ./include/net/ipv6.h:12,
from ./include/rdma/ib_verbs.h:51,
from ./include/linux/mlx5/device.h:37,
from ./include/linux/mlx5/driver.h:51,
from
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c:37:
[1] https://lore.kernel.org/netdev/[email protected]/
Signed-off-by: Qian Cai <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This is a no-op that simply moves all locking and unlocking of
->reg_lock into trivial helpers. I did that to be able to easily add
some ad hoc instrumentation to those helpers to get some information
on contention and hold times of the mutex. Perhaps others want to do
something similar at some point, so this frees them from doing the
'sed -i' yoga, and have a much smaller 'git diff' while fiddling.
Signed-off-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Vivien Didelot <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
We have a dedicated pointer for that, so use it. Much easier to read and
less computation involved.
Signed-off-by: Wolfram Sang <[email protected]>
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
The current code of create_queues_with_size_backoff() allows the ring size
to become as small as ENA_MIN_RING_SIZE/2. This is a bug since we don't
want the queue ring to be smaller than ENA_MIN_RING_SIZE
In this commit we change the loop's termination condition to look at the
queue size of the next iteration instead of that of the current one,
so that the minimal queue size again becomes ENA_MIN_RING_SIZE.
Fixes: eece4d2ab9 ("net: ena: add ethtool function for changing io queue sizes")
Signed-off-by: Arthur Kiyanovski <[email protected]>
Signed-off-by: Sameeh Jubran <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This is added based on the fact that this is an iforce-based device and
that the Windows driver for the R440 works for the Logitech WingMan Formula
Force after replacing the device/vendor IDs.
Signed-off-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Instead of open-coding conversion from/to little-endian, let's
use proper accessors.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Transport initialization code now deals mostly with transport-specific
data, so we can drop couple of temporary variables.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
It is not needed anymore as behavior is controlled by the transport
operations set up for given device.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
USB transport has to use cache line-aligned buffers for transfers to avoid
DMA issues; serio doe snot have such restrictions. Let's move "data_in"
buffer from main driver structure into transport modules and make sure USB
requirements are respected.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
We want to move buffer handling into transport layers as the properties of
buffers (DMA-safety, alignment, etc) are different for different
transports. To allow this, let's allow caller to specify their own buffers
for the results of iforce_get_id_packet() and let transport drivers to
figure what buffers they need to use for transfers.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
It is excessive to check if device is fully initialized in
iforce_process_packet(), as for USB-conected devices we do not start
collecting reports until the device is fully initialized.
Let's change serio transport code to not call iforce_process_packet()
until device initialization is done.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Signalling command completion from iforce_process_packet() does
not make sense, as not all transport use the same data path for
both commands and motion data form the device, that is why USB
code already has to signal command completion iforce_usb_out().
Let's move signalling completion into individual transport
modules.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Current code combines packet type and data length into single argument to
iforce_process_packet() and then has to untangle it. It is much clearer to
simply use separate arguments.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
According to our coding style case labels in switch statements should
be aligned with the switch keyword.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
When working with USB devices we need to use DMA-safe buffers,
and iforce->edata is not one. Let's rework the code to allocate
temporary buffer (iforce_get_id() is called only during initialization
so there is no reason to have permanent buffer) and use it. While at it,
let's utilize usb_control_msg() API which simplifies code.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Now that we have moved enough transport details into separate source files
we can change them into transport modules so that they are only loaded when
needed.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
This moves transport-specific data from main iforce structure into
transport modules.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Note that the parent device for the USB-connected controllers is now
USB interface instead of USB device.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Add start_io() and stop_io() transport methods so that core
does not have to know the details.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
Continue teasing apart protocol-specific bits from core into transport
modules. This time move RS232-specific command completion handling
from core to iforce-serio module.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
To avoid #ifdef-ing out parts of the code and having conditionals in normal
control flow, let's define "get_id" transport method and move
implementation into respective transport modules.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
In order to tease apart the driver into core and transport modules, let's
introduce transport operations and make "xmit" the very first one such
operation.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
The kernel is supposed to handle multiple devices, static flags
in packet handling code will never work.
Tested-by: Tim Schumacher <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct gpio_keys_drvdata {
...
struct gpio_button_data data[0];
};
size = sizeof(struct gpio_keys_drvdata) + count * sizeof(struct gpio_button_data);
instance = devm_kzalloc(dev, size, GFP_KERNEL);
Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:
instance = devm_kzalloc(dev, struct_size(instance, data, count), GFP_KERNEL);
Notice that, in this case, variable size is not necessary, hence it
is removed.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct gpio_keys_polled_dev {
...
struct gpio_keys_button_data data[0];
};
size = sizeof(struct gpio_keys_polled_dev) + count * sizeof(struct gpio_keys_button_data);
instance = devm_kzalloc(dev, size, GFP_KERNEL);
Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:
instance = devm_kzalloc(dev, struct_size(instance, data, count), GFP_KERNEL);
Notice that, in this case, variable size is not necessary, hence it
is removed.
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
This adds an x86-specific test for pinned cr4 bits. A successful test
will validate pinning and check the ROP-style call-middle-of-function
defense, if needed. For example, in the case of native_write_cr4()
looking like this:
ffffffff8171bce0 <native_write_cr4>:
ffffffff8171bce0: 48 8b 35 79 46 f2 00 mov 0xf24679(%rip),%rsi
ffffffff8171bce7: 48 09 f7 or %rsi,%rdi
ffffffff8171bcea: 0f 22 e7 mov %rdi,%cr4
...
ffffffff8171bd5a: c3 retq
The UNSET_SMEP test will jump to ffffffff8171bcea (the mov to cr4)
instead of ffffffff8171bce0 (native_write_cr4() entry) to simulate a
direct-call bypass attempt.
Expected successful results:
# echo UNSET_SMEP > /sys/kernel/debug/provoke-crash/DIRECT
# dmesg
[ 79.594433] lkdtm: Performing direct entry UNSET_SMEP
[ 79.596459] lkdtm: trying to clear SMEP normally
[ 79.598406] lkdtm: ok: SMEP did not get cleared
[ 79.599981] lkdtm: trying to clear SMEP with call gadget
[ 79.601810] ------------[ cut here ]------------
[ 79.603421] Attempt to unpin cr4 bits: 100000; bypass attack?!
...
[ 79.650170] ---[ end trace 2452ca0f6126242e ]---
[ 79.650937] lkdtm: ok: SMEP removal was reverted
Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The variable ret is being initialized with the value -EINVAL however
this value is never read and ret is being re-assigned later on. Hence
the initialization is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <[email protected]>
Acked-by: Kees Cook <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
There is no point to print deferred probe messages as errors. Adjust
the printks for error paths of obtaining clocks and reset controller.
This removes the error message of lima_clk_init() call in favor or
specific failure messages inside.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
There is no point to print deferred probe (and its failures to get
resources) as an error. For example getting a regulator causes three
unneeded error messages:
lima 13000000.gpu: failed to get regulator: -517
lima 13000000.gpu: regulator init fail -517
lima 13000000.gpu: Fatal error during GPU init
Also do not print clock rates before the initialization finishes
because they will be duplicated after deferral. Each probe step already
prints error so remove the final error message "Fatal error during GPU
init".
In case of multiple probe tries this would pollute the dmesg.
Fixes: a1d2a63399 ("drm/lima: driver for ARM Mali4xx GPUs")
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]