Commit 2f5cc7f
rapidio: fix possible UAF when kfifo_alloc() fails
[ Upstream commit 02d7d89 ]
If kfifo_alloc() fails in mport_cdev_open(), goto err_fifo and just free
priv. But priv is still in the chdev->file_list, then list traversal
may cause UAF. This fixes the following smatch warning:
drivers/rapidio/devices/rio_mport_cdev.c:1930 mport_cdev_open() warn: '&priv->list' not removed from list
Link: https://lkml.kernel.org/r/20221123095147.52408-1-wangweiyang2@huawei.com
Fixes: e8de370 ("rapidio: add mport char device driver")
Signed-off-by: Wang Weiyang <wangweiyang2@huawei.com>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Jakob Koschel <jakobkoschel@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 337b68d commit 2f5cc7f
1 file changed
+3
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1903 | 1903 | | |
1904 | 1904 | | |
1905 | 1905 | | |
1906 | | - | |
1907 | | - | |
1908 | | - | |
1909 | | - | |
1910 | 1906 | | |
1911 | 1907 | | |
1912 | 1908 | | |
| |||
1925 | 1921 | | |
1926 | 1922 | | |
1927 | 1923 | | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1928 | 1927 | | |
1929 | 1928 | | |
1930 | 1929 | | |
| |||
0 commit comments