mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
termios, tty/tty_baudrate.c: fix buffer overrun
On architectures with CBAUDEX == 0 (Alpha and PowerPC), the code in tty_baudrate.c does not do any limit checking on the tty_baudrate[] array, and in fact a buffer overrun is possible on both architectures. Add a limit check to prevent that situation. This will be followed by a much bigger cleanup/simplification patch. Signed-off-by: H. Peter Anvin (Intel) <[email protected]> Requested-by: Cc: Johan Hovold <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Al Viro <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Matt Turner <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Kate Stewart <[email protected]> Cc: Philippe Ombredanne <[email protected]> Cc: Eugene Syromiatnikov <[email protected]> Cc: Alan Cox <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
943210ba80
commit
991a251940
1 changed files with 2 additions and 2 deletions
|
|
@ -77,7 +77,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios)
|
|||
else
|
||||
cbaud += 15;
|
||||
}
|
||||
return baud_table[cbaud];
|
||||
return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
|
||||
}
|
||||
EXPORT_SYMBOL(tty_termios_baud_rate);
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios)
|
|||
else
|
||||
cbaud += 15;
|
||||
}
|
||||
return baud_table[cbaud];
|
||||
return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
|
||||
#else /* IBSHIFT */
|
||||
return tty_termios_baud_rate(termios);
|
||||
#endif /* IBSHIFT */
|
||||
|
|
|
|||
Loading…
Reference in a new issue