mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
switch netlink_getsockbyfilp() to taking descriptor
the only call site (in do_mq_notify()) obtains the argument from an immediately preceding fdget() and it is immediately followed by fdput(); might as well just replace it with a variant that would take a descriptor instead of struct file * and have file lookups handled inside that function. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -1355,13 +1355,7 @@ static int do_mq_notify(mqd_t mqdes, const struct sigevent *notification)
|
||||
skb_put(nc, NOTIFY_COOKIE_LEN);
|
||||
/* and attach it to the socket */
|
||||
retry:
|
||||
f = fdget(notification->sigev_signo);
|
||||
if (!fd_file(f)) {
|
||||
ret = -EBADF;
|
||||
goto out;
|
||||
}
|
||||
sock = netlink_getsockbyfilp(fd_file(f));
|
||||
fdput(f);
|
||||
sock = netlink_getsockbyfd(notification->sigev_signo);
|
||||
if (IS_ERR(sock)) {
|
||||
ret = PTR_ERR(sock);
|
||||
goto free_skb;
|
||||
|
||||
Reference in New Issue
Block a user