]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.6/can-fix-handling-of-unmodifiable-configuration-options-fix.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.6 / can-fix-handling-of-unmodifiable-configuration-options-fix.patch
1 From bce271f255dae8335dc4d2ee2c4531e09cc67f5a Mon Sep 17 00:00:00 2001
2 From: Oliver Hartkopp <socketcan@hartkopp.net>
3 Date: Tue, 21 Jun 2016 12:14:07 +0200
4 Subject: can: fix handling of unmodifiable configuration options fix
5
6 From: Oliver Hartkopp <socketcan@hartkopp.net>
7
8 commit bce271f255dae8335dc4d2ee2c4531e09cc67f5a upstream.
9
10 With upstream commit bb208f144cf3f59 (can: fix handling of unmodifiable
11 configuration options) a new can_validate() function was introduced.
12
13 When invoking 'ip link set can0 type can' without any configuration data
14 can_validate() tries to validate the content without taking into account that
15 there's totally no content. This patch adds a check for missing content.
16
17 Reported-by: ajneu <ajneu1@gmail.com>
18 Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
19 Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/net/can/dev.c | 3 +++
24 1 file changed, 3 insertions(+)
25
26 --- a/drivers/net/can/dev.c
27 +++ b/drivers/net/can/dev.c
28 @@ -798,6 +798,9 @@ static int can_validate(struct nlattr *t
29 * - control mode with CAN_CTRLMODE_FD set
30 */
31
32 + if (!data)
33 + return 0;
34 +
35 if (data[IFLA_CAN_CTRLMODE]) {
36 struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);
37