Skip to contentSkip to conversation

Patch "rtnetlink: allocate more memory for dev_set_mac_address()" has been added to the 3.18-stable tree

PATCH [email protected] 1 participant 1 message Aug 9, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

rtnetlink: allocate more memory for dev_set_mac_address()

to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
rtnetlink-allocate-more-memory-for-dev_set_mac_address.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Tue Aug 8 16:54:20 PDT 2017

From: WANG Cong <[email protected]>
Date: Thu, 20 Jul 2017 11:27:57 -0700
Subject: rtnetlink: allocate more memory for dev_set_mac_address()

From: WANG Cong <[email protected]>

[ Upstream commit 153711f9421be5dbc973dc57a4109dc9d54c89b1 ]

virtnet_set_mac_address() interprets mac address as struct sockaddr, but upper layer only allocates dev->addr_len which is ETH_ALEN + sizeof(sa_family_t) in this case.

We lack a unified definition for mac address, so just fix the upper layer, this also allows drivers to interpret it to struct sockaddr freely.

---
 net/core/rtnetlink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +2 -1
@@ -1554,7 +1554,8 @@ static int do_setlink(const struct sk_bu
 		struct sockaddr *sa;
 		int len;
 
-		len = sizeof(sa_family_t) + dev->addr_len;
+		len = sizeof(sa_family_t) + max_t(size_t, dev->addr_len,
+						  sizeof(*sa));
 		sa = kmalloc(len, GFP_KERNEL);
 		if (!sa) {
 			err = -ENOMEM;

Patches currently in stable-queue which might be from [email protected] are

queue-3.18/net-sched-fix-soft-lockup-in-tc_classify.patch queue-3.18/packet-fix-use-after-free-in-prb_retire_rx_blk_timer_expired.patch queue-3.18/rtnetlink-allocate-more-memory-for-dev_set_mac_address.patch