Patch "misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     misc-tifm-fix-possible-memory-leak-in-tifm_7xx1_swit.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e1af1e12a4dc065f0505a5ff88e610c91f9c683b
Author: ruanjinjie <ruanjinjie@xxxxxxxxxx>
Date:   Thu Nov 17 14:47:25 2022 +0800

    misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()
    
    [ Upstream commit fd2c930cf6a5b9176382c15f9acb1996e76e25ad ]
    
    If device_register() returns error in tifm_7xx1_switch_media(),
    name of kobject which is allocated in dev_set_name() called in device_add()
    is leaked.
    
    Never directly free @dev after calling device_register(), even
    if it returned an error! Always use put_device() to give up the
    reference initialized.
    
    Fixes: 2428a8fe2261 ("tifm: move common device management tasks from tifm_7xx1 to tifm_core")
    Signed-off-by: ruanjinjie <ruanjinjie@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221117064725.3478402-1-ruanjinjie@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index a37a42f67088..8498282d1212 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -194,7 +194,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
 				spin_unlock_irqrestore(&fm->lock, flags);
 			}
 			if (sock)
-				tifm_free_device(&sock->dev);
+				put_device(&sock->dev);
 		}
 		spin_lock_irqsave(&fm->lock, flags);
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux