stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "rtnetlink: allocate more memory for dev_set_mac_address()" has been added to the 4.4-stable tree
@ 2017-08-09  0:19 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-08-09  0:19 UTC (permalink / raw)
  To: xiyou.wangcong, davem, dsahern, gregkh; +Cc: stable, stable-commits


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 4.4-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-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From foo@baz Tue Aug  8 16:51:58 PDT 2017
From: WANG Cong <xiyou.wangcong@gmail.com>
Date: Thu, 20 Jul 2017 11:27:57 -0700
Subject: rtnetlink: allocate more memory for dev_set_mac_address()

From: WANG Cong <xiyou.wangcong@gmail.com>


[ 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.

Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/rtnetlink.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1742,7 +1742,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 xiyou.wangcong@gmail.com are

queue-4.4/packet-fix-use-after-free-in-prb_retire_rx_blk_timer_expired.patch
queue-4.4/rtnetlink-allocate-more-memory-for-dev_set_mac_address.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-09  0:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09  0:19 Patch "rtnetlink: allocate more memory for dev_set_mac_address()" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).