summaryrefslogtreecommitdiff
path: root/include/uapi/linux/msg.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-02-01 09:32:46 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-03-11 11:59:41 +0100
commit13a79f14ab285120bc4977e00a7c731e8143f548 (patch)
tree77c1e4a3f06e175a0e589ae8df37ce0dc8271da4 /include/uapi/linux/msg.h
parente5f3b2f4f2377434dc9118db47191d2f72533ab9 (diff)
media: dvb-usb: Fix memory leak at error in dvb_usb_device_init()
dvb_usb_device_init() allocates a dvb_usb_device object, but it doesn't release the object by itself even at errors. The object is released in the callee side (dvb_usb_init()) in some error cases via dvb_usb_exit() call, but it also missed the object free in other error paths. And, the caller (it's only dvb_usb_device_init()) doesn't seem caring the resource management as well, hence those memories are leaked. This patch assures releasing the memory at the error path in dvb_usb_device_init(). Now dvb_usb_init() frees the resources it allocated but leaves the passed dvb_usb_device object intact. In turn, the dvb_usb_device object is released in dvb_usb_device_init() instead. We could use dvb_usb_exit() function for releasing everything in the callee (as it was used for some error cases in the original code), but releasing the passed object in the callee is non-intuitive and error-prone. So I took this approach (which is more standard in Linus kernel code) although it ended with a bit more open codes. Along with the change, the patch makes sure that USB intfdata is reset and don't return the bogus pointer to the caller of dvb_usb_device_init() at the error path, too. Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'include/uapi/linux/msg.h')
0 files changed, 0 insertions, 0 deletions