linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Yicong Yang <yangyicong@hisilicon.com>
To: Michael Walle <michael@walle.cc>
Cc: <tudor.ambarus@microchip.com>, <p.yadav@ti.com>,
	<linux-mtd@lists.infradead.org>, <miquel.raynal@bootlin.com>,
	<richard@nod.at>, <vigneshr@ti.com>, <linuxarm@huawei.com>,
	<prime.zeng@huawei.com>
Subject: Re: [PATCH RESEND] mtd:spi-nor: Fix an issue of releasing resources during read/write
Date: Thu, 8 Apr 2021 19:10:54 +0800	[thread overview]
Message-ID: <057754d2-1438-4adb-4773-b1ae18f635ae@hisilicon.com> (raw)
In-Reply-To: <2f4b541e47046ee55728bca1a383033c@walle.cc>

On 2021/4/7 22:50, Michael Walle wrote:
> Hi,
> 
> nit: subject should be "mtd: spi-nor: Fix.."
> 

thanks. maybe Tudor can get this fixed, or i'll
send a v2 one.

> Am 2021-04-01 09:34, schrieb Yicong Yang:
>> From: Xiang Chen <chenxiang66@hisilicon.com>
>>
>> If rmmod the driver during read or write, the driver will release the
>> resources which are used during read or write, so it is possible to
>> refer to NULL pointer.
>>
>> Use the testcase "mtd_debug read /dev/mtd0 0xc00000 0x400000 dest_file &
>> sleep 0.5;rmmod spi_hisi_sfc_v3xx.ko", the issue can be reproduced in
>> hisi_sfc_v3xx driver.
>>
>> To avoid the issue, fill the interface _get_device and _put_device of
>> mtd_info to grab the reference to the spi controller driver module, so
>> the request of rmmod the driver is rejected before read/write is finished.
>>
>> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
>> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
> 
> Reviewed-by: Michael Walle <michael@walle.cc>
> Tested-by: Michael Walle <michael@walle.cc> [with spi-nxp-fspi and spi-fsl-dspi]
> 
> btw. you can also do:
> lsmod
> exec 3<> /dev/mtd0
> lsmod
> 
> and have a look at the ref count.
> 

yes, it works. the ref count are get by the open() callback. thanks for the hint.

thanks
Yicong

> -michael
> 
> .


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-04-08 11:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01  7:34 [PATCH RESEND] mtd:spi-nor: Fix an issue of releasing resources during read/write Yicong Yang
2021-04-07 14:50 ` Michael Walle
2021-04-08 11:10   ` Yicong Yang [this message]
2021-04-09  3:21 ` Tudor.Ambarus
2021-04-09  4:03   ` Yicong Yang
2021-04-09  4:13     ` Tudor.Ambarus
2021-04-09  6:05       ` Yicong Yang
2021-04-11  7:45 ` Tudor Ambarus

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=057754d2-1438-4adb-4773-b1ae18f635ae@hisilicon.com \
    --to=yangyicong@hisilicon.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linuxarm@huawei.com \
    --cc=michael@walle.cc \
    --cc=miquel.raynal@bootlin.com \
    --cc=p.yadav@ti.com \
    --cc=prime.zeng@huawei.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.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 NNTP newsgroup(s).