Commit 803ec1f
drm/bridge: samsung-dsim: Fix memory leak in error path
In samsung_dsim_host_attach(), drm_bridge_add() is called to add the
bridge. However, if samsung_dsim_register_te_irq() or
pdata->host_ops->attach() fails afterwards, the function returns
without removing the bridge, causing a memory leak.
Fix this by adding proper error handling with goto labels to ensure
drm_bridge_remove() is called in all error paths. Also ensure that
samsung_dsim_unregister_te_irq() is called if the attach operation
fails after the TE IRQ has been registered.
samsung_dsim_unregister_te_irq() function is moved without changes
to be before samsung_dsim_host_attach() to avoid forward declaration.
Fixes: e744712 ("drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge")
Cc: stable@vger.kernel.org
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20260209184115.10937-1-osama.abdelkader@gmail.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>1 parent 496daa2 commit 803ec1f
1 file changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1881 | 1881 | | |
1882 | 1882 | | |
1883 | 1883 | | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
1884 | 1892 | | |
1885 | 1893 | | |
1886 | 1894 | | |
| |||
1955 | 1963 | | |
1956 | 1964 | | |
1957 | 1965 | | |
1958 | | - | |
| 1966 | + | |
1959 | 1967 | | |
1960 | 1968 | | |
1961 | 1969 | | |
1962 | 1970 | | |
1963 | 1971 | | |
1964 | | - | |
| 1972 | + | |
1965 | 1973 | | |
1966 | 1974 | | |
1967 | 1975 | | |
1968 | 1976 | | |
1969 | 1977 | | |
1970 | 1978 | | |
1971 | 1979 | | |
1972 | | - | |
1973 | 1980 | | |
1974 | | - | |
1975 | | - | |
1976 | | - | |
1977 | | - | |
1978 | | - | |
1979 | | - | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
1980 | 1987 | | |
1981 | 1988 | | |
1982 | 1989 | | |
| |||
0 commit comments