Skip to content

Commit

Permalink
mISDN: Fix a use after free in hfcmulti_tx()
Browse files Browse the repository at this point in the history
Don't dereference *sp after calling dev_kfree_skb(*sp).

Fixes: af69fb3 ("Add mISDN HFC multiport driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/8be65f5a-c2dd-4ba0-8a10-bfe5980b8cfb@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Dan Carpenter authored and kuba-moo committed Jul 25, 2024
1 parent 36e3b94 commit 61ab751
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/isdn/hardware/mISDN/hfcmulti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ hfcmulti_dtmf(struct hfc_multi *hc)
static void
hfcmulti_tx(struct hfc_multi *hc, int ch)
{
int i, ii, temp, len = 0;
int i, ii, temp, tmp_len, len = 0;
int Zspace, z1, z2; /* must be int for calculation */
int Fspace, f1, f2;
u_char *d;
Expand Down Expand Up @@ -2122,14 +2122,15 @@ hfcmulti_tx(struct hfc_multi *hc, int ch)
HFC_wait_nodebug(hc);
}

tmp_len = (*sp)->len;
dev_kfree_skb(*sp);
/* check for next frame */
if (bch && get_next_bframe(bch)) {
len = (*sp)->len;
len = tmp_len;
goto next_frame;
}
if (dch && get_next_dframe(dch)) {
len = (*sp)->len;
len = tmp_len;
goto next_frame;
}

Expand Down

0 comments on commit 61ab751

Please sign in to comment.