From: Basil Gunn <basil@pacabunga.com>
To: Joerg Reuter <jreuter@yaina.de>,
Ralf Baechle <ralf@linux-mips.org>,
"David S. Miller" <davem@davemloft.net>,
linux-hams@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, Edouard Lafargue <ed@wizkers.io>,
Jeremy McDermond <mcdermj@xenotropic.com>
Subject: [PATCH 1/1] ax25: Fix segfault when receiving an iframe with net2kiss loaded
Date: Wed, 30 Nov 2016 11:15:25 -0800 [thread overview]
Message-ID: <20161130111525.13f74728@brox.localnet> (raw)
AX.25 uses sock_queue_rcv_skb() to queue an iframe received packet.
This routine writes NULL to the socket buffer device structure
pointer. The socket buffer is subsequently serviced by
__netif_receiv_skb_core() which dereferences the device structure
pointer & segfaults.
The fix puts the ax25 device structure pointer back in the socket
buffer struct after sock_queue_rcv_skb() is called.
To trigger the segfault setup an ax.25 device (ax0) then run net2kiss
(net2kiss -v -i ax0 /dev/ptmx). In another console make an ax.25
connection (call udr0 jnbbs). Within 2 received packets a segfault
will occur.
Please submit to -stable.
Signed-off-by: Basil Gunn <basil@pacabunga.com>
---
net/ax25/ax25_in.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index bb5a0e4..417f21a 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -144,10 +144,15 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
if (ax25->sk != NULL && ax25->ax25_dev->values[AX25_VALUES_CONMODE] == 2) {
if ((!ax25->pidincl && ax25->sk->sk_protocol == pid) ||
ax25->pidincl) {
+ /* Will set socket buffer device struct pointer,
+ * skb->dev to NULL
+ */
if (sock_queue_rcv_skb(ax25->sk, skb) == 0)
queued = 1;
else
ax25->condition |= AX25_COND_OWN_RX_BUSY;
+
+ skb->dev = ax25->ax25_dev->dev;
}
}
--
2.1.4
next reply other threads:[~2016-11-30 19:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 19:15 Basil Gunn [this message]
2016-12-02 16:05 ` [PATCH 1/1] ax25: Fix segfault when receiving an iframe with net2kiss loaded David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161130111525.13f74728@brox.localnet \
--to=basil@pacabunga.com \
--cc=davem@davemloft.net \
--cc=ed@wizkers.io \
--cc=jreuter@yaina.de \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcdermj@xenotropic.com \
--cc=netdev@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).