linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] pipe: fix potential use-after-free in pipe_read()
Date: Tue, 23 Nov 2021 09:09:42 +0800	[thread overview]
Message-ID: <3d1da34f-7b47-3d19-40ce-98b62d6e6f6d@huawei.com> (raw)
In-Reply-To: <YZJbBNs/63pnXngK@casper.infradead.org>



On 2021/11/15 21:05, Matthew Wilcox wrote:
> On Mon, Nov 15, 2021 at 02:13:44PM +0800, Leizhen (ThunderTown) wrote:
>>
>>
>> On 2021/11/15 12:25, Matthew Wilcox wrote:
>>> On Mon, Nov 15, 2021 at 11:57:20AM +0800, Zhen Lei wrote:
>>>>  			if (!buf->len) {
>>>> +				unsigned int __maybe_unused flags = buf->flags;
>>>
>>> Why __maybe_unused?
>>
>> It's used only if "#ifdef CONFIG_WATCH_QUEUE". Otherwise, a warning will be reported.
> 
> Better to turn the #ifdef into if (IS_ENABLED())

Hi, Matthew:
  Thank you for your advice. IS_ENABLED() is a good idea, but when I tried it, I found that
the macro 'PIPE_BUF_FLAG_LOSS' and the structure member 'note_loss' were also separated by
"ifdef CONFIG_WATCH_QUEUE", so this method is not suitable here.

#ifdef CONFIG_WATCH_QUEUE
#define PIPE_BUF_FLAG_LOSS     0x40    /* Message loss happened after this buffer */
#endif

@@ -62,9 +60,7 @@ struct pipe_inode_info {
        unsigned int tail;
        unsigned int max_usage;
        unsigned int ring_size;
#ifdef CONFIG_WATCH_QUEUE
        bool note_loss;
#endif



> .
> 

  reply	other threads:[~2021-11-23  1:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  3:57 [PATCH 0/2] pipe: Fix a potential UAF and delete a duplicate line of code Zhen Lei
2021-11-15  3:57 ` [PATCH 1/2] pipe: fix potential use-after-free in pipe_read() Zhen Lei
2021-11-15  4:25   ` Matthew Wilcox
2021-11-15  6:13     ` Leizhen (ThunderTown)
2021-11-15 13:05       ` Matthew Wilcox
2021-11-23  1:09         ` Leizhen (ThunderTown) [this message]
2021-11-15  3:57 ` [PATCH 2/2] pipe: delete a duplicate line of code in pipe_write() Zhen Lei

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=3d1da34f-7b47-3d19-40ce-98b62d6e6f6d@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@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;
as well as URLs for NNTP newsgroup(s).