Re: [PATCH] ipc: WARN if trying to remove ipc object which is absent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 30, 2021 at 10:00:07AM +0100, Manfred Spraul wrote:
> Hi,
> 
> On 11/29/21 20:48, Alexander Mikhalitsyn wrote:
> > For 4.14.y:
> > 
> > Upstream commit 126e8bee943e ("ipc: WARN if trying to remove ipc object which is absent")
> > 
> > Patch series "shm: shm_rmid_forced feature fixes".
> [...]
> > ---
> >   ipc/util.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/ipc/util.c b/ipc/util.c
> > index 5a65b0cbae7d..198b4c1c3ad3 100644
> > --- a/ipc/util.c
> > +++ b/ipc/util.c
> > @@ -409,8 +409,8 @@ static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
> >   static void ipc_kht_remove(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
> >   {
> >   	if (ipcp->key != IPC_PRIVATE)
> > -		rhashtable_remove_fast(&ids->key_ht, &ipcp->khtnode,
> > -				       ipc_kht_params);
> > +		WARN_ON_ONCE(rhashtable_remove_fast(&ids->key_ht, &ipcp->khtnode,
> > +				       ipc_kht_params));
> >   }
> >   /**
> > @@ -425,7 +425,7 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
> >   {
> >   	int lid = ipcid_to_idx(ipcp->id);
> > -	idr_remove(&ids->ipcs_idr, lid);
> > +	WARN_ON_ONCE(idr_remove(&ids->ipcs_idr, lid) != ipcp);
> >   	ipc_kht_remove(ids, ipcp);
> >   	ids->in_use--;
> >   	ipcp->deleted = true;
> 
> Tested: With the patch applied, the warning is printed.
> 
> 
> --
> 
>     manfred
> 

Now queued up, thanks.

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux