[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_508F9F7681360F657D131FF97D2C53506208@qq.com>
Date: Wed, 30 Mar 2022 22:44:50 +0800
From: chenchacha <chen.chenchacha@...mail.com>
To: minyard@....org
Cc: openipmi-developer@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, Corey Minyard <cminyard@...sta.com>
Subject: Re: [PATCH 2/4] ipmi: Limit the number of message a user may have
outstanding
> @@ -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?
--
Chen Guanqiao
Powered by blists - more mailing lists