]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
of/device: Prevent buffer overflow in of_device_modalias()
authorBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 24 Aug 2017 01:04:04 +0000 (18:04 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Sun, 10 Sep 2017 23:08:59 +0000 (18:08 -0500)
commitb6af0800ff8da6cc0862ef377378e01c5d6b49fa
treed4a38a7336bdb84aa9507436a8fa7ecc59e7d1bd
parent9189c03e1f513985d7a3171ef10a4b16afb8f394
of/device: Prevent buffer overflow in of_device_modalias()

BugLink: http://bugs.launchpad.net/bugs/1716284
commit 08ab58d9de3eb8498ae0585001d0975e46217a39 upstream.

As of_device_get_modalias() returns the number of bytes that would have
been written to the target string, regardless of how much did fit in the
buffer, it's possible that the returned index points beyond the buffer
passed to of_device_modalias() - causing memory beyond the buffer to be
null terminated.

Fixes: 0634c2958927 ("of: Add function for generating a DT modalias with a newline")
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/of/device.c