lkml.org 
[lkml]   [2022]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH V6 01/16] rv: Add Runtime Verification (RV) interface
    On Tue, 19 Jul 2022 19:27:06 +0200
    Daniel Bristot de Oliveira <bristot@kernel.org> wrote:

    > +/*
    > + * enabled_monitors interface.
    > + */


    Doesn't the rv_monitors_list need to be protected by the rv_interface_lock
    mutex?

    > +static void disable_all_monitors(void)
    > +{
    > + struct rv_monitor_def *mdef;
    > +

    I think you need:

    mutex_lock(&rv_interface_lock);

    > + list_for_each_entry(mdef, &rv_monitors_list, list)
    > + disable_monitor(mdef);

    mutex_unlock(&rv_interface_lock);

    > +}
    > +
    > +static int enabled_monitors_open(struct inode *inode, struct file *file)
    > +{

    As this gets called directly from the open system call.

    > + if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC))
    > + disable_all_monitors();
    > +
    > + return seq_open(file, &enabled_monitors_seq_ops);
    > +};
    > +

    [..]

    > +
    > +static const struct file_operations enabled_monitors_ops = {
    > + .open = enabled_monitors_open,

    Here.

    -- Steve

    > + .read = seq_read,
    > + .write = enabled_monitors_write,
    > + .llseek = seq_lseek,
    > + .release = seq_release,
    > +};

    \
     
     \ /
      Last update: 2022-07-20 17:23    [W:2.360 / U:0.160 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site