From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:60562 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbdGAONg (ORCPT ); Sat, 1 Jul 2017 10:13:36 -0400 Subject: Patch "net: don't call strlen on non-terminated string in dev_set_alias()" has been added to the 3.18-stable tree To: glider@google.com, davem@davemloft.net, gregkh@linuxfoundation.org Cc: , From: Date: Sat, 01 Jul 2017 16:13:23 +0200 Message-ID: <1498918403172209@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled net: don't call strlen on non-terminated string in dev_set_alias() 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: net-don-t-call-strlen-on-non-terminated-string-in-dev_set_alias.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 know about it. >>From foo@baz Thu Jun 29 19:45:34 CEST 2017 From: Alexander Potapenko Date: Tue, 6 Jun 2017 15:56:54 +0200 Subject: net: don't call strlen on non-terminated string in dev_set_alias() From: Alexander Potapenko [ Upstream commit c28294b941232931fbd714099798eb7aa7e865d7 ] KMSAN reported a use of uninitialized memory in dev_set_alias(), which was caused by calling strlcpy() (which in turn called strlen()) on the user-supplied non-terminated string. Signed-off-by: Alexander Potapenko Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1194,8 +1194,9 @@ int dev_set_alias(struct net_device *dev if (!new_ifalias) return -ENOMEM; dev->ifalias = new_ifalias; + memcpy(dev->ifalias, alias, len); + dev->ifalias[len] = 0; - strlcpy(dev->ifalias, alias, len+1); return len; } Patches currently in stable-queue which might be from glider@google.com are queue-3.18/net-don-t-call-strlen-on-non-terminated-string-in-dev_set_alias.patch