mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
char: misc: Does not request module for miscdevice with dynamic minor
[ Upstream commit 1ba0fb42aa6a5f072b1b8c0b0520b32ad4ef4b45 ] misc_open() may request module for miscdevice with dynamic minor, which is meaningless since: - The dynamic minor allocated is unknown in advance without registering miscdevice firstly. - Macro MODULE_ALIAS_MISCDEV() is not applicable for dynamic minor. Fix by only requesting module for miscdevice with fixed minor. Acked-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com> Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250714-rfc_miscdev-v6-6-2ed949665bde@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a3f918b791
commit
87ac021c84
1 changed files with 5 additions and 3 deletions
|
|
@ -113,7 +113,8 @@ static int misc_open(struct inode *inode, struct file *file)
|
|||
}
|
||||
}
|
||||
|
||||
if (!new_fops) {
|
||||
/* Only request module for fixed minor code */
|
||||
if (!new_fops && minor < MISC_DYNAMIC_MINOR) {
|
||||
mutex_unlock(&misc_mtx);
|
||||
request_module("char-major-%d-%d", MISC_MAJOR, minor);
|
||||
mutex_lock(&misc_mtx);
|
||||
|
|
@ -124,10 +125,11 @@ static int misc_open(struct inode *inode, struct file *file)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!new_fops)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!new_fops)
|
||||
goto fail;
|
||||
|
||||
/*
|
||||
* Place the miscdevice in the file's
|
||||
* private_data so it can be used by the
|
||||
|
|
|
|||
Loading…
Reference in a new issue