History

V4L/DVB: IR/mceusb: remove bad ir_input_dev use

The ir_input_dev gets filled in by __ir_input_register, the one allocated in mceusb_init_input_dev was being overwritten by the correct one shortly after it was initialized (ultimately resulting in a memory leak). This bug was inherited from imon.c, and was pointed out to me by Maxim Levitsky. v2: fix incorrect dev arg to dev_dbg

Jarod Wilson committed 16 years ago

Commit 7a9fcb41 parent da48db61 file · +1 −14Browse files

Unified · Split

drivers/media/IR/mceusb.c+1−14
@@ -228,7 +228,6 @@ static struct usb_device_id std_tx_mask_list[] = { · 227 unmodified lines
228228 /* data structure for each usb transceiver */
229229 struct mceusb_dev {
230230 /* ir-core bits */
231− struct ir_input_dev *irdev;
232231 struct ir_dev_props *props;
233232 struct ir_raw_event rawir;
234233
@@ -739,7 +738,7 @@ static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs) · 504 unmodified lines
739738
740739 if (ir->send_flags == RECV_FLAG_IN_PROGRESS) {
741740 ir->send_flags = SEND_FLAG_COMPLETE;
742− dev_dbg(&ir->irdev->dev, "setup answer received %d bytes\n",
741+ dev_dbg(ir->dev, "setup answer received %d bytes\n",
743742 buf_len);
744743 }
745744
@@ -861,7 +860,6 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) · 115 unmodified lines
861860 {
862861 struct input_dev *idev;
863862 struct ir_dev_props *props;
864− struct ir_input_dev *irdev;
865863 struct device *dev = ir->dev;
866864 int ret = -ENODEV;
867865
@@ -878,12 +876,6 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) · 10 unmodified lines
878876 goto props_alloc_failed;
879877 }
880878
881− irdev = kzalloc(sizeof(struct ir_input_dev), GFP_KERNEL);
882− if (!irdev) {
883− dev_err(dev, "remote ir input dev allocation failed\n");
884− goto ir_dev_alloc_failed;
885− }
886−
887879 snprintf(ir->name, sizeof(ir->name), "Media Center Ed. eHome "
888880 "Infrared Remote Transceiver (%04x:%04x)",
889881 le16_to_cpu(ir->usbdev->descriptor.idVendor),
@@ -902,9 +894,6 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) · 12 unmodified lines
902894 props->tx_ir = mceusb_tx_ir;
903895
904896 ir->props = props;
905− ir->irdev = irdev;
906−
907− input_set_drvdata(idev, irdev);
908897
909898 ret = ir_input_register(idev, RC_MAP_RC6_MCE, props, DRIVER_NAME);
910899 if (ret < 0) {
@@ -915,8 +904,6 @@ static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) · 4 unmodified lines
915904 return idev;
916905
917906 irdev_failed:
918− kfree(irdev);
919−ir_dev_alloc_failed:
920907 kfree(props);
921908 props_alloc_failed:
922909 input_free_device(idev);