Re: [PATCH v1 1/4] console: disallow opening for writing when no write method defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 20, 2019 at 09:58:10AM +0200, Ahmad Fatoum wrote:
> Some consoles, like the input console (usually /dev/cs0), don't feature
> a puts or putc callback. Trying to echo out of them would thus crash:
> 
> 	barebox@Embest MarS Board i.MX6Dual:/ echo -a /dev/cs0
> 	prefetch abort
> 	pc : [<00000004>]    lr : [<4fd05071>]
> 	WARNING: [<...>] (fops_write+0xd/0x10)
> 	WARNING: [<...>] (devfs_write+0x21/0x2a)
> 	WARNING: [<...>] (__write+0xcb/0xf0)
> 	WARNING: [<...>] (write+0x2d/0x68)
> 	WARNING: [<...>] (dputc+0x31/0x34)
> 	WARNING: [<...>] (do_echo+0xcb/0x144)
> 
> Fix this by only allowing open(.., O_WRONLY) or open(..., O_RDWR) when
> puts is defined. Consoles defining putc are covered by this as well as
> those have putc-calling __console_puts assigned as their puts when they
> are registered. Now echo -a /dev/cs0 would yield:
> 
> 	open: Operation not permitted
> 
> Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx>
> ---

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux