netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mISDN: hfcpci: Fix a use after free in hfcmulti_tx()
@ 2020-10-22  7:07 Dan Carpenter
  2020-10-22 14:24 ` isdn
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-10-22  7:07 UTC (permalink / raw)
  To: Karsten Keil
  Cc: Petr Mladek, Sergey Senozhatsky, Kefeng Wang, netdev, kernel-janitors

This frees "*sp" before dereferencing it to get "len = (*sp)->len;".

Fixes: af69fb3a8ffa ("Add mISDN HFC multiport driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/isdn/hardware/mISDN/hfcmulti.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 7013a3f08429..ce6c160e0df4 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -2152,16 +2152,14 @@ hfcmulti_tx(struct hfc_multi *hc, int ch)
 		HFC_wait_nodebug(hc);
 	}
 
+	len = (*sp)->len;
 	dev_kfree_skb(*sp);
 	/* check for next frame */
-	if (bch && get_next_bframe(bch)) {
-		len = (*sp)->len;
+	if (bch && get_next_bframe(bch))
 		goto next_frame;
-	}
-	if (dch && get_next_dframe(dch)) {
-		len = (*sp)->len;
+
+	if (dch && get_next_dframe(dch))
 		goto next_frame;
-	}
 
 	/*
 	 * now we have no more data, so in case of transparent,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-22 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22  7:07 [PATCH net] mISDN: hfcpci: Fix a use after free in hfcmulti_tx() Dan Carpenter
2020-10-22 14:24 ` isdn
2020-10-22 14:44   ` Dan Carpenter

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).