Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 293d984f0e36 ("ctcm: infrastructure for replaced ctc driver")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexandra Winter and committed by
David S. Miller
0c0b2058 2c50c686

+1 -5
+1 -5
drivers/s390/net/ctcm_mpc.c
··· 626 626 ctcm_clear_busy_do(dev); 627 627 } 628 628 629 - kfree(mpcginfo); 630 - 631 629 return; 632 630 633 631 } ··· 1190 1192 CTCM_FUNTAIL, dev->name); 1191 1193 priv->stats.rx_dropped++; 1192 1194 /* mpcginfo only used for non-data transfers */ 1193 - kfree(mpcginfo); 1194 1195 if (do_debug_data) 1195 1196 ctcmpc_dump_skb(pskb, -8); 1196 1197 } 1198 + kfree(mpcginfo); 1197 1199 } 1198 1200 done: 1199 1201 ··· 1975 1977 } 1976 1978 break; 1977 1979 } 1978 - kfree(mpcginfo); 1979 1980 1980 1981 CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", 1981 1982 __func__, ch->id, grp->outstanding_xid2, ··· 2035 2038 mpc_validate_xid(mpcginfo); 2036 2039 break; 2037 2040 } 2038 - kfree(mpcginfo); 2039 2041 return; 2040 2042 } 2041 2043