]> git.baikalelectronics.ru Git - kernel.git/commit
tty: serial: sh-sci: set error code when kasprintf fails
authorPan Bian <bianpan2016@163.com>
Sat, 3 Dec 2016 10:40:25 +0000 (18:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:51:24 +0000 (11:51 +0100)
commitd292bfb16c5d322495a5f98bd97fa76d7bfcff3d
tree59b7d58d020565db0c543fe63c043541cfc70ff1
parent56bfd77d2de4945a1b3920bf962cd2407ff74379
tty: serial: sh-sci: set error code when kasprintf fails

When the call to kasprintf() returns a NULL pointer, function
sci_request_irq() frees the preallocated memory and returns 0 is
returned. Because 0 means no error, the caller of sci_request_irq()
will keep going, and the freed memory may be used or freed again. To
avoid the above issue, this patch assigns "-ENOMEM" to the return
variable ret.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188691

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c