Skip to content

Commit 54dac3d

Browse files
author
Al Viro
committed
do_mq_notify(): switch to CLASS(fd)
The only failure exit before fdget() is a return, the only thing done after fdput() is transposable with it. Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 1aaf6a7 commit 54dac3d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

ipc/mqueue.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
13171317
static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
13181318
{
13191319
int ret;
1320-
struct fd f;
13211320
struct sock *sock;
13221321
struct inode *inode;
13231322
struct mqueue_inode_info *info;
@@ -1370,16 +1369,16 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
13701369
}
13711370
}
13721371

1373-
f = fdget(mqdes);
1374-
if (!fd_file(f)) {
1372+
CLASS(fd, f)(mqdes);
1373+
if (fd_empty(f)) {
13751374
ret = -EBADF;
13761375
goto out;
13771376
}
13781377

13791378
inode = file_inode(fd_file(f));
13801379
if (unlikely(fd_file(f)->f_op != &mqueue_file_operations)) {
13811380
ret = -EBADF;
1382-
goto out_fput;
1381+
goto out;
13831382
}
13841383
info = MQUEUE_I(inode);
13851384

@@ -1418,8 +1417,6 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
14181417
inode_set_atime_to_ts(inode, inode_set_ctime_current(inode));
14191418
}
14201419
spin_unlock(&info->lock);
1421-
out_fput:
1422-
fdput(f);
14231420
out:
14241421
if (sock)
14251422
netlink_detachskb(sock, nc);

0 commit comments

Comments
 (0)