lkml.org 
[lkml]   [2021]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 1/2] pipe: fix potential use-after-free in pipe_read()
From
Date


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



> .
>

\
 
 \ /
  Last update: 2021-11-23 02:10    [W:0.466 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site