]> git.baikalelectronics.ru Git - kernel.git/commit
serial: 8250_exar: Avoid NULL pointer dereference at ->exit()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 8 Jun 2021 14:42:37 +0000 (17:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jun 2021 12:40:48 +0000 (14:40 +0200)
commit2c70815218ca85f7d554952e795e9604b08edf82
tree1922b3ae5ce8a097b22546dacfc2b35173b427d5
parent522fa64953e0d3fbb5fa5fd7565121714af2a489
serial: 8250_exar: Avoid NULL pointer dereference at ->exit()

It's possible that during ->exit() the private_data is NULL,
for instance when there was no GPIO device instantiated.
Due to this we may not dereference it. Add a respective check.

Note, for now ->exit() only makes sense when GPIO device
was instantiated, that's why we may use the check for entire
function.

Fixes: b37eff3fbf07 ("serial: 8250_exar: Constify the software nodes")
Reported-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Maxim Levitsky <mlevitsk@redhat.com>
Link: https://lore.kernel.org/r/20210608144239.12697-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_exar.c