Skip to content

Commit 0c0b205

Browse files
SandyWinterdavem330
authored andcommitted
s390/ctcm: fix potential memory leak
smatch complains about drivers/s390/net/ctcm_mpc.c:1210 ctcmpc_unpack_skb() warn: possible memory leak of 'mpcginfo' mpc_action_discontact() did not free mpcginfo. Consolidate the freeing in ctcmpc_unpack_skb(). Fixes: 293d984 ("ctcm: infrastructure for replaced ctc driver") Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2c50c68 commit 0c0b205

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

drivers/s390/net/ctcm_mpc.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,6 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo)
626626
ctcm_clear_busy_do(dev);
627627
}
628628

629-
kfree(mpcginfo);
630-
631629
return;
632630

633631
}
@@ -1192,10 +1190,10 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
11921190
CTCM_FUNTAIL, dev->name);
11931191
priv->stats.rx_dropped++;
11941192
/* mpcginfo only used for non-data transfers */
1195-
kfree(mpcginfo);
11961193
if (do_debug_data)
11971194
ctcmpc_dump_skb(pskb, -8);
11981195
}
1196+
kfree(mpcginfo);
11991197
}
12001198
done:
12011199

@@ -1977,7 +1975,6 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg)
19771975
}
19781976
break;
19791977
}
1980-
kfree(mpcginfo);
19811978

19821979
CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n",
19831980
__func__, ch->id, grp->outstanding_xid2,
@@ -2038,7 +2035,6 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg)
20382035
mpc_validate_xid(mpcginfo);
20392036
break;
20402037
}
2041-
kfree(mpcginfo);
20422038
return;
20432039
}
20442040

0 commit comments

Comments
 (0)