mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v1 1/4] console: disallow opening for writing when no write method defined
Date: Mon, 23 Sep 2019 08:59:43 +0200	[thread overview]
Message-ID: <20190923065943.mrug644cnw24aabw@pengutronix.de> (raw)
In-Reply-To: <20190920075813.22471-1-ahmad@a3f.at>

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@a3f.at>
> ---

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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2019-09-23  6:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  7:58 Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 2/4] input: set console input name as input Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 3/4] common: ubsan: ignore shifting one into sign bit Ahmad Fatoum
2019-09-21  7:47   ` Rouven Czerwinski
2019-09-21 10:59     ` Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 4/4] USB: gadget: ACM: don't announce V.25ter support Ahmad Fatoum
2019-09-20  8:51   ` Ahmad Fatoum
2019-09-21 11:00     ` Ahmad Fatoum
2019-09-23  6:59 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190923065943.mrug644cnw24aabw@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox