]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bnx2x: prevent crash when accessing PTP with interface down
authorMichal Schmidt <mschmidt@redhat.com>
Fri, 3 Mar 2017 16:08:28 +0000 (17:08 +0100)
committerSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Fri, 14 Jul 2017 17:53:48 +0000 (10:53 -0700)
commit77e553b566d4dd35757264792db81ec23b7ad396
tree82a37c1a121a6171b744b9df4c2680b9ad1dcf9c
parent743583f42063a5d1c44874a1456389170871d3c3
bnx2x: prevent crash when accessing PTP with interface down

It is possible to crash the kernel by accessing a PTP device while its
associated bnx2x interface is down. Before the interface is brought up,
the timecounter is not initialized, so accessing it results in NULL
dereference.

Fix it by checking if the interface is up.

Use -ENETDOWN as the error code when the interface is down.
 -EFAULT in bnx2x_ptp_adjfreq() did not seem right.

Tested using phc_ctl get/set/adj/freq commands.

Orabug: 26440216

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 466e8bf10ac104d96e1ea813e8126e11cb72ea20)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c