lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220330145838.GY3458@minyard.net>
Date:   Wed, 30 Mar 2022 09:58:38 -0500
From:   Corey Minyard <cminyard@...sta.com>
To:     chenchacha <chen.chenchacha@...mail.com>
Cc:     minyard@....org, openipmi-developer@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] ipmi: Limit the number of message a user may have
 outstanding

On Wed, Mar 30, 2022 at 10:44:50PM +0800, chenchacha wrote:
> > @@ -2298,6 +2309,14 @@ static int i_ipmi_request(struct ipmi_user     *user,
> >   	struct ipmi_recv_msg *recv_msg;
> >   	int rv = 0;
> > +	if (user) {
> > +		if (atomic_add_return(1, &user->nr_msgs) > max_msgs_per_user) {
> > +			atomic_dec(&user->nr_msgs);
> > +			rv = -EBUSY;
> > +			goto out;
> > +		}
> > +	}
> > +
> > @@ -2369,6 +2388,8 @@ static int i_ipmi_request(struct ipmi_user     *user,
> >   	rcu_read_unlock();
> >   out:
> > +	if (rv && user)
> > +		atomic_dec(&user->nr_msgs);
> >   	return rv;
> >   }
> 
> If the number of msg is greater than the limit, the nr_msgs will be decrease
> twice.
> 
> Should it be returned directory?

Oh wait, yeah, I screwed that up.  I added the first decrement later,
after I "noticed" it was missing.  I should add a comment there.
Thanks.

-corey

> 
> --
> Chen Guanqiao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ