Skip to contentSkip to conversation

can: fix handling of unmodifiable configuration options fix

PATCH Applied Oliver Hartkopp 2 participants 2 messages Jun 21, 2016 – Jun 23, 2016 CAN network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: fix handling of unmodifiable configuration options fix

With upstream commit bb208f144cf3f59 (can: fix handling of unmodifiable configuration options) a new can_validate() function was introduced.

When invoking 'ip link set can0 type can' without any configuration data can_validate() tries to validate the content without taking into account that there's totally no content. This patch adds a check for missing content.

---
 drivers/net/can/dev.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/can/dev.c +3 -0
index 910c12e..348dd50 100644
@@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[])
 	 * - control mode with CAN_CTRLMODE_FD set
 	 */
 
+	if (!data)
+		return 0;
+
 	if (data[IFLA_CAN_CTRLMODE]) {
 		struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]);
 
Signature · 1 line
2.8.1
maintainer Applied
#1 lore raw
Quoted 9 lines · Oliver Hartkopp

With upstream commit bb208f144cf3f59 (can: fix handling of unmodifiable configuration options) a new can_validate() function was introduced.

When invoking 'ip link set can0 type can' without any configuration data can_validate() tries to validate the content without taking into account that there's totally no content. This patch adds a check for missing content.

Applied to can + stable on Cc.

Tnx,
Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |