Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 689ca31

Browse files
ZheyuMagregkh
authored andcommitted
tty: synclink_gt: Fix null-pointer-dereference in slgt_clean()
When the driver fails at alloc_hdlcdev(), and then we remove the driver module, we will get the following splat: [ 25.065966] general protection fault, probably for non-canonical address 0xdffffc0000000182: 0000 [#1] PREEMPT SMP KASAN PTI [ 25.066914] KASAN: null-ptr-deref in range [0x0000000000000c10-0x0000000000000c17] [ 25.069262] RIP: 0010:detach_hdlc_protocol+0x2a/0x3e0 [ 25.077709] Call Trace: [ 25.077924] <TASK> [ 25.078108] unregister_hdlc_device+0x16/0x30 [ 25.078481] slgt_cleanup+0x157/0x9f0 [synclink_gt] Fix this by checking whether the 'info->netdev' is a null pointer first. Reviewed-by: Jiri Slaby <[email protected]> Signed-off-by: Zheyu Ma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7fb4028 commit 689ca31

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/tty/synclink_gt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,8 @@ static int hdlcdev_init(struct slgt_info *info)
17461746
*/
17471747
static void hdlcdev_exit(struct slgt_info *info)
17481748
{
1749+
if (!info->netdev)
1750+
return;
17491751
unregister_hdlc_device(info->netdev);
17501752
free_netdev(info->netdev);
17511753
info->netdev = NULL;

0 commit comments

Comments
 (0)