From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:55974 "EHLO omzsmtpe02.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751170AbdFDIM2 (ORCPT ); Sun, 4 Jun 2017 04:12:28 -0400 From: "Levin, Alexander (Sasha Levin)" Cc: Ralf Baechle , Thomas Osterried , "David S . Miller" , "Levin, Alexander (Sasha Levin)" To: "stable@vger.kernel.org" Subject: [PATCH for v4.9 LTS 015/111] NET: mkiss: Fix panic Date: Sun, 4 Jun 2017 08:11:53 +0000 Message-ID: <20170604081123.19462-15-alexander.levin@verizon.com> References: <20170604081123.19462-1-alexander.levin@verizon.com> In-Reply-To: <20170604081123.19462-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Ralf Baechle [ Upstream commit 7ba1b689038726d34e3244c1ac9e2e18c2ea4787 ] If a USB-to-serial adapter is unplugged, the driver re-initializes, with dev->hard_header_len and dev->addr_len set to zero, instead of the correct values. If then a packet is sent through the half-dead interface, the kernel will panic due to running out of headroom in the skb when pushing for the AX.25 headers resulting in this panic: [] (skb_panic) from [] (skb_push+0x4c/0x50) [] (skb_push) from [] (ax25_hard_header+0x34/0xf4 [ax25= ]) [] (ax25_hard_header [ax25]) from [] (ax_header+0x38/0x= 40 [mkiss]) [] (ax_header [mkiss]) from [] (neigh_compat_output+0x8= c/0xd8) [] (neigh_compat_output) from [] (ip_finish_output+0x2a= 0/0x914) [] (ip_finish_output) from [] (ip_output+0xd8/0xf0) [] (ip_output) from [] (ip_local_out_sk+0x44/0x48) This patch makes mkiss behave like the 6pack driver. 6pack does not panic. In 6pack.c sp_setup() (same function name here) the values for dev->hard_header_len and dev->addr_len are set to the same values as in my mkiss patch. [ralf@linux-mips.org: Massages original submission to conform to the usual standards for patch submissions.] Signed-off-by: Thomas Osterried Signed-off-by: Ralf Baechle Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/hamradio/mkiss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 1dfe2304daa7..e0a6b1a0ca88 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -648,8 +648,8 @@ static void ax_setup(struct net_device *dev) { /* Finish setting up the DEVICE info. */ dev->mtu =3D AX_MTU; - dev->hard_header_len =3D 0; - dev->addr_len =3D 0; + dev->hard_header_len =3D AX25_MAX_HEADER_LEN; + dev->addr_len =3D AX25_ADDR_LEN; dev->type =3D ARPHRD_AX25; dev->tx_queue_len =3D 10; dev->header_ops =3D &ax25_header_ops; --=20 2.11.0