Skip to content

Commit 82d1208

Browse files
tcchen2026gregkh
authored andcommitted
char: applicom: fix NULL pointer dereference in ac_ioctl
Discovered by Atuin - Automated Vulnerability Discovery Engine. In ac_ioctl, the validation of IndexCard and the check for a valid RamIO pointer are skipped when cmd is 6. However, the function unconditionally executes readb(apbs[IndexCard].RamIO + VERS) at the end. If cmd is 6, IndexCard may reference a board that does not exist (where RamIO is NULL), leading to a NULL pointer dereference. Fix this by skipping the readb access when cmd is 6, as this command is a global information query and does not target a specific board context. Signed-off-by: Tianchu Chen <flynnnchen@tencent.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: stable <stable@kernel.org> Link: https://patch.msgid.link/20251128155323.a786fde92ebb926cbe96fcb1@linux.dev Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cbe1d77 commit 82d1208

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/char/applicom.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,10 @@ static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
835835
ret = -ENOTTY;
836836
break;
837837
}
838-
Dummy = readb(apbs[IndexCard].RamIO + VERS);
838+
839+
if (cmd != 6)
840+
Dummy = readb(apbs[IndexCard].RamIO + VERS);
841+
839842
kfree(adgl);
840843
mutex_unlock(&ac_mutex);
841844
return ret;

0 commit comments

Comments
 (0)