linux_dsm_epyc7002/drivers/media/dvb/frontends
Jesper Juhl 7e270941c8 [media] Zarlink zl10036 DVB-S: Fix mem leak in zl10036_attach
On Thu, 17 Feb 2011, Matthias Schwarzott wrote:

> On Sunday 06 February 2011, Jesper Juhl wrote:
> > If the memory allocation to 'state' succeeds but we jump to the 'error'
> > label before 'state' is assigned to fe->tuner_priv, then the call to
> > 'zl10036_release(fe)' at the 'error:' label will not free 'state', but
> > only what was previously assigned to 'tuner_priv', thus leaking the memory
> > allocated to 'state'.
> > There are may ways to fix this, including assigning the allocated memory
> > directly to 'fe->tuner_priv', but I did not go for that since the
> > additional pointer derefs are more expensive than the local variable, so I
> > just added a 'kfree(state)' call. I guess the call to 'zl10036_release'
> > might not even be needed in this case, but I wasn't sure, so I left it in.
> >
> Yeah, that call to zl10036_release can be completely eleminated.
> Another thing is: jumping to the error label only makes sense when memory was
> already allocated. So the jump in line 471 can be replaced by "return NULL",
> as the other error handling before allocation:
>         if (NULL == config) {
>                 printk(KERN_ERR "%s: no config specified", __func__);
>                 goto error;
>         }
>
> I suggest to improve the patch to clean the code up when changing that.
>
> But I am fine with commiting this patch also if you do not want to change it.
>

Thank you for your feedback. It makes a lot of sense.
Changing it is not a problem :)
How about the updated patch below?

If the memory allocation to 'state' succeeds but we jump to the 'error'
label before 'state' is assigned to fe->tuner_priv, then the call to
'zl10036_release(fe)' at the 'error:' label will not free 'state', but
only what was previously assigned to 'tuner_priv', thus leaking the memory
allocated to 'state'.
This patch fixes the leak and also does not jump to 'error:' before mem
has been allocated but instead just returns. Also some small style
cleanups.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 06:51:55 -03:00
..
af9013_priv.h [media] af9013: optimize code size 2010-10-21 01:17:54 -02:00
af9013.c [media] af9013: reimplement firmware download 2011-03-22 04:55:02 -03:00
af9013.h V4L/DVB: af9013: add support for MaxLinear MxL5007T tuner 2010-10-21 01:05:51 -02:00
atbm8830_priv.h V4L/DVB: Fix bad whitespacing 2010-05-18 00:47:01 -03:00
atbm8830.c [media] drivers/media: Removed unnecessary KERN_<level>s from dprintk uses 2010-12-29 08:16:29 -02:00
atbm8830.h V4L/DVB (13374): AltoBeam ATBM8830 GB20600-2006(DMB-TH) demodulator 2009-12-05 18:41:34 -02:00
au8522_decoder.c [media] au8522: Handle differences in comb filter config for s-video input 2010-12-29 08:16:34 -02:00
au8522_dig.c V4L/DVB: au8522: fix case where we don't perform the first tune after going digital 2010-05-18 00:46:22 -03:00
au8522_priv.h [media] au8522: Handle differences in comb filter config for s-video input 2010-12-29 08:16:34 -02:00
au8522.h
bcm3510_priv.h
bcm3510.c
bcm3510.h
bsbe1.h
bsru6.h
cx22700.c V4L/DVB (12575): Fix test of bandwidth range in cx22700_set_tps() 2009-09-12 12:19:34 -03:00
cx22700.h
cx22702.c V4L/DVB: cx22702: Simplify cx22702_set_tps() 2010-10-21 01:06:10 -02:00
cx22702.h
cx24110.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
cx24110.h
cx24113.c tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
cx24113.h
cx24116.c Revert "V4L/DVB: Add FE_CAN_PSK_8 to allow apps to identify PSK_8 capable DVB devices" 2010-05-19 12:57:48 -03:00
cx24116.h
cx24123.c [media] i2c: Stop using I2C_CLASS_TV_DIGITAL 2010-10-21 07:54:26 -02:00
cx24123.h
dib0070.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
dib0070.h V4L/DVB (13583): DiB8090: Add the DiB0090 tuner driver and STK8096GP-board 2009-12-16 00:18:16 -02:00
dib0090.c [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
dib0090.h [media] DiB0090: misc improvements 2011-03-21 20:31:41 -03:00
dib3000.h
dib3000mb_priv.h V4L/DVB: remove obsolete conditionalizing on DVB_DIBCOM_DEBUG 2010-08-02 16:42:46 -03:00
dib3000mb.c V4L/DVB: remove obsolete conditionalizing on DVB_DIBCOM_DEBUG 2010-08-02 16:42:46 -03:00
dib3000mc.c V4L/DVB: "dib3000mc: reduce large stack usage" fix 2010-08-02 16:42:59 -03:00
dib3000mc.h
dib7000m.c [media] DiB7000M: add pid filtering 2011-03-02 13:45:12 -03:00
dib7000m.h [media] DiB7000M: add pid filtering 2011-03-02 13:45:12 -03:00
dib7000p.c [media] dib7000p: Fix 4-byte wrong alignments for some case statements 2011-03-21 20:31:43 -03:00
dib7000p.h [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
dib8000.c [media] dib8000: fix small memory leak on error 2011-03-21 20:32:39 -03:00
dib8000.h [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
dib9000.c [media] dib9000: fix return type in dib9000_mbx_send_attr() 2011-03-21 20:32:39 -03:00
dib9000.h [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
dibx000_common.c [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
dibx000_common.h [media] DiBxxxx: Codingstype updates 2011-03-21 20:31:43 -03:00
drx397xD_fw.h
drx397xD.c V4L/DVB: drivers/media: Use available error codes 2010-10-21 01:04:48 -02:00
drx397xD.h
ds3000.c [media] ds3000: wrong hardware tune function implemented 2011-03-21 20:32:40 -03:00
ds3000.h [media] cx88: add support for TeVii S464 PCI card 2011-03-21 20:32:27 -03:00
dvb_dummy_fe.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
dvb_dummy_fe.h
dvb-pll.c [media] dvb_pll: DVB-S incorrect tune settings for dw2102/dm1105/cx88/opera1 2011-03-21 20:32:21 -03:00
dvb-pll.h V4L/DVB (12290): dvb-pll: Add support for Alps TDEE4 DVB-C NIM 2009-09-12 12:17:50 -03:00
ec100_priv.h V4L/DVB (13363): ec100: add new driver for E3C EC100 DVB-T demodulator 2009-12-05 18:41:32 -02:00
ec100.c V4L/DVB (13363): ec100: add new driver for E3C EC100 DVB-T demodulator 2009-12-05 18:41:32 -02:00
ec100.h V4L/DVB (13363): ec100: add new driver for E3C EC100 DVB-T demodulator 2009-12-05 18:41:32 -02:00
eds1547.h
isl6405.c
isl6405.h
isl6421.c
isl6421.h
isl6423.c V4L/DVB (11583): isl6423: Various fixes to use external modulation 2009-06-16 18:20:38 -03:00
isl6423.h V4L/DVB (11579): Initial go at TT S2-1600 2009-06-16 18:20:37 -03:00
itd1000_priv.h V4L/DVB (11284): Fix i2c code of flexcop-driver for rare revisions 2009-03-30 12:43:47 -03:00
itd1000.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
itd1000.h
ix2505v.c [media] frontends/ix2505v: Remember to free allocated memory in failure path 2011-01-19 11:45:44 -02:00
ix2505v.h V4L/DVB: Support for Sharp IX2505V (marked B0017) DVB-S silicon tuner 2010-10-21 01:04:53 -02:00
Kconfig [media] Support for stv0367 multi-standard demodulator 2011-03-21 20:32:17 -03:00
l64781.c V4L/DVB: dvb: l64781.ko broken with gcc 4.5 2010-02-19 03:19:01 -02:00
l64781.h
lgdt330x_priv.h
lgdt330x.c tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
lgdt330x.h
lgdt3305.c V4L/DVB: lgdt3305: enable FE_HAS_SIGNAL hack for the lgdt3304 in QAM mode 2010-08-02 14:47:41 -03:00
lgdt3305.h V4L/DVB: lgdt3305: update copyright date and MODULE_VERSION 2010-08-02 14:47:19 -03:00
lgs8gl5.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
lgs8gl5.h
lgs8gxx_priv.h V4L/DVB (12271): lgs8gxx: add lgs8g75 support 2009-09-12 12:17:38 -03:00
lgs8gxx.c [media] drivers/media: Removed unnecessary KERN_<level>s from dprintk uses 2010-12-29 08:16:29 -02:00
lgs8gxx.h V4L/DVB (12271): lgs8gxx: add lgs8g75 support 2009-09-12 12:17:38 -03:00
lnbh24.h
lnbp21.c V4L/DVB: 22-kHz set_tone fix for NetUP Dual DVB-S2-CI card. 22kHz logic controlled by demod 2010-02-26 15:10:41 -03:00
lnbp21.h
Makefile [media] Support for stv0367 multi-standard demodulator 2011-03-21 20:32:17 -03:00
mb86a16_priv.h V4L/DVB (13811): [MB86A16] Update Copyright header 2010-01-17 11:55:45 -02:00
mb86a16.c V4L/DVB: drivers/media/dvb/frontends: remove duplicate structure field initialization 2010-08-02 15:29:18 -03:00
mb86a16.h V4L/DVB (13811): [MB86A16] Update Copyright header 2010-01-17 11:55:45 -02:00
mb86a20s.c [media] mb86a20s: Be sure that device is initialized before starting DVB 2011-01-19 11:45:25 -02:00
mb86a20s.h [media] mb86a20s: add support for serial streams 2010-12-29 08:16:28 -02:00
mt312_priv.h
mt312.c V4L/DVB (12200): mt312: Fix checkpatch warnings 2009-09-12 12:17:24 -03:00
mt312.h
mt352_priv.h
mt352.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
mt352.h V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
nxt200x.c V4L/DVB (11723): Link firmware to physical device 2009-06-16 18:20:56 -03:00
nxt200x.h
nxt6000_priv.h
nxt6000.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
nxt6000.h
or51132.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
or51132.h
or51211.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
or51211.h
s5h1409.c V4L/DVB (13332): s5h1409: remove a set register that would cause lock to be lost. 2009-12-05 18:41:23 -02:00
s5h1409.h V4L/DVB (13329): s5h1409: provide HVR-1600 specific optimizations 2009-12-05 18:41:22 -02:00
s5h1411.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
s5h1411.h
s5h1420_priv.h
s5h1420.c [media] i2c: Stop using I2C_CLASS_TV_DIGITAL 2010-10-21 07:54:26 -02:00
s5h1420.h
s5h1432.c [media] CodingStyle cleanup at s5h1432 and cx231xx 2010-10-21 01:17:45 -02:00
s5h1432.h [media] CodingStyle cleanup at s5h1432 and cx231xx 2010-10-21 01:17:45 -02:00
s921.c [media] Re-write the s921 frontend 2010-12-29 08:16:26 -02:00
s921.h [media] Re-write the s921 frontend 2010-12-29 08:16:26 -02:00
si21xx.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
si21xx.h
sp887x.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
sp887x.h
sp8870.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
sp8870.h
stb0899_algo.c
stb0899_cfg.h
stb0899_drv.c [media] stb0899: fix diseqc messages getting lost 2010-12-29 08:16:49 -02:00
stb0899_drv.h
stb0899_priv.h
stb0899_reg.h
stb6000.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
stb6000.h
stb6100_cfg.h
stb6100_proc.h V4L/DVB (13407): Add Prof 7301 PCI DVB-S2 card 2009-12-05 18:41:43 -02:00
stb6100.c [media] stb6100: warning cleanup 2010-12-29 08:16:52 -02:00
stb6100.h V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
stv090x_priv.h V4L/DVB (13976): [STV090x] Added mutex protection around tuner I2C access. 2010-02-26 15:10:36 -03:00
stv090x_reg.h [media] stv090x: Fixed typos in register macros 2011-03-21 20:31:45 -03:00
stv090x.c [media] stv090x: handle allocation failures 2011-03-21 20:32:36 -03:00
stv090x.h [media] stv090x: Optional external lock routine 2011-03-21 20:31:44 -03:00
stv0288.c [media] DiSEqC bug fixed for stv0288 based interfaces 2010-10-21 07:55:58 -02:00
stv0288.h
stv0297.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
stv0297.h
stv0299.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
stv0299.h V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
stv0367_priv.h [media] Support for stv0367 multi-standard demodulator 2011-03-21 20:32:17 -03:00
stv0367_regs.h [media] Support for stv0367 multi-standard demodulator 2011-03-21 20:32:17 -03:00
stv0367.c [media] stv0367: implement uncorrected blocks counter 2011-03-22 04:54:10 -03:00
stv0367.h [media] Initial commit to support NetUP Dual DVB-T/C CI RF card 2011-03-21 20:32:18 -03:00
stv0900_core.c [media] stv0900: Update status when LOCK is missed 2011-03-21 20:32:40 -03:00
stv0900_init.h V4L/DVB (13338): stv0900: big rework to support cut 3.0. 2009-12-05 18:41:25 -02:00
stv0900_priv.h V4L/DVB (13818): Add Prof 7500 DVB-S2 USB card 2010-02-26 15:10:24 -03:00
stv0900_reg.h V4L/DVB (13818): Add Prof 7500 DVB-S2 USB card 2010-02-26 15:10:24 -03:00
stv0900_sw.c V4L/DVB: STV0900 Cut 3.0 AGC2 fix for NetUP Dual DVB-S2-CI card 2010-02-26 15:10:56 -03:00
stv0900.h [media] dw2102: Prof 7500: Lock LED implemented 2011-03-21 20:32:26 -03:00
stv6110.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
stv6110.h V4L/DVB (13334): stv6110: add configurable gain 2009-12-05 18:41:23 -02:00
stv6110x_priv.h V4L/DVB (13981): [STV6110x] Add a local register map for each instance of the driver. 2010-02-26 15:10:36 -03:00
stv6110x_reg.h V4L/DVB (11579): Initial go at TT S2-1600 2009-06-16 18:20:37 -03:00
stv6110x.c V4L/DVB: stv6110x: Fix kernel null pointer deref 2010-06-01 01:21:50 -03:00
stv6110x.h V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control 2010-05-18 00:46:47 -03:00
tda665x.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tda665x.h V4L/DVB (13809): Fix Checkpatch violations 2010-01-17 11:55:44 -02:00
tda826x.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tda826x.h
tda1002x.h
tda1004x.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
tda1004x.h
tda8083.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
tda8083.h
tda8261_cfg.h
tda8261.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tda8261.h
tda10021.c V4L/DVB (13791): [TDA10021] Do not claim TDA10023 2010-01-17 11:55:42 -02:00
tda10023.c
tda10048.c V4L/DVB: tda10048: clear the uncorrected packet registers when saturated 2010-08-02 15:35:39 -03:00
tda10048.h V4L/DVB (11854): TDA10048: Ensure the I/F changes during DVB-T 6/7/8 bandwidth changes. 2009-06-16 18:21:13 -03:00
tda10086.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
tda10086.h
tdhd1.h
tua6100.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tua6100.h
ves1x93.c V4L/DVB (12440): Use kzalloc for frontend states to have struct dvb_frontend properly 2009-08-13 20:39:14 -03:00
ves1x93.h
ves1820.c V4L/DVB (12483): Use DIV_ROUND_CLOSEST 2009-09-12 12:19:08 -03:00
ves1820.h
z0194a.h
zl10036.c [media] Zarlink zl10036 DVB-S: Fix mem leak in zl10036_attach 2011-03-22 06:51:55 -03:00
zl10036.h
zl10039.c V4L/DVB (13965): zl10039, jump to error on error 2010-02-26 15:10:35 -03:00
zl10039.h V4L/DVB (12461): Add ce5039(zl10039) tuner support. 2009-09-12 12:18:55 -03:00
zl10353_priv.h
zl10353.c V4L/DVB: drivers/media: Make static data tables and strings const 2010-10-21 01:04:52 -02:00
zl10353.h