]> git.baikalelectronics.ru Git - kernel.git/commit
qede: fix write to free'd pointer error and double free of ptp
authorColin Ian King <colin.king@canonical.com>
Fri, 12 Apr 2019 14:13:27 +0000 (15:13 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Apr 2019 23:55:47 +0000 (16:55 -0700)
commit65067b515cbb27edbf18e732a7867abb3870c10b
treeaf01b1f03d5bfaeaa837f5a8586c000ac5cb67db
parentc37d445a9ea577fd34200906352904093fd014fb
qede: fix write to free'd pointer error and double free of ptp

The err2 error return path calls qede_ptp_disable that cleans up
on an error and frees ptp. After this, the free'd ptp is dereferenced
when ptp->clock is set to NULL and the code falls-through to error
path err1 that frees ptp again.

Fix this by calling qede_ptp_disable and exiting via an error
return path that does not set ptp->clock or kfree ptp.

Addresses-Coverity: ("Write to pointer after free")
Fixes: a0eaea5776b5 ("qede: Add support for PTP resource locking.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qede/qede_ptp.c