LKML Archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Purna Chandra Mandal <purna.mandal@microchip.com>
Cc: Joshua Henderson <joshua.henderson@microchip.com>,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: Fix incomplete handling of SPI_MASTER_MUST_RX/_MUST_TX
Date: Mon, 8 Feb 2016 16:15:42 +0000	[thread overview]
Message-ID: <20160208161542.GF7265@sirena.org.uk> (raw)
In-Reply-To: <56B42C68.4030909@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]

On Fri, Feb 05, 2016 at 10:30:24AM +0530, Purna Chandra Mandal wrote:

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> Idea is good, but not sufficient.
> Dummy buffers are _reallocated_ to accommodate larger size of transfer. In this if
> [originally NULL] .rx_buf/.tx_buf is not reset back to NULL after the transfer
> is over spi-core will find those .rx/tx_buf non-NULL in next _transfer() call and
> will pass the stale rx/tx_buf to spi controller driver which will definitely
> corrupt the memory and crash the system.

This needs to be clear to readers; a fairly obvious way of dealing with
this would be to rellocate down to a page rather than freeing.

> Above all the whole design depends on trust that core will not play with any data-structure
> which will break object-oriented/layered approach. So better to undo the modification
> (when needed to facilitate some functionality) unless core wants those information to be passed
> back to caller/client for reporting success or error or else.

That's really not the case, we already make a range of other
modifications to complete partially filled transfers in order to
simplify driver code.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-02-08 16:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 22:39 [PATCH] spi: Fix incomplete handling of SPI_MASTER_MUST_RX/_MUST_TX Joshua Henderson
2016-02-01 23:17 ` Mark Brown
2016-02-05  5:00   ` Purna Chandra Mandal
2016-02-08 16:15     ` Mark Brown [this message]
2016-03-01 12:17       ` Purna Chandra Mandal

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=20160208161542.GF7265@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=joshua.henderson@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=purna.mandal@microchip.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).