Skip to content

Commit 7d60a7a

Browse files
committed
compat_ioctl: move rfcomm handlers into driver
All these ioctl commands are compatible, so we can handle them with a trivial wrapper in rfcomm/sock.c and remove the listing in fs/compat_ioctl.c. Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 5565a3c commit 7d60a7a

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎fs/compat_ioctl.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242

4343
#include <net/bluetooth/bluetooth.h>
4444
#include <net/bluetooth/hci_sock.h>
45-
#include <net/bluetooth/rfcomm.h>
4645

4746
#ifdef CONFIG_BLOCK
4847
#include <linux/cdrom.h>
@@ -673,11 +672,6 @@ COMPATIBLE_IOCTL(HCIUARTGETPROTO)
673672
COMPATIBLE_IOCTL(HCIUARTGETDEVICE)
674673
COMPATIBLE_IOCTL(HCIUARTSETFLAGS)
675674
COMPATIBLE_IOCTL(HCIUARTGETFLAGS)
676-
COMPATIBLE_IOCTL(RFCOMMCREATEDEV)
677-
COMPATIBLE_IOCTL(RFCOMMRELEASEDEV)
678-
COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
679-
COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
680-
COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
681675
/* Misc. */
682676
COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
683677
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)

‎net/bluetooth/rfcomm/sock.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* RFCOMM sockets.
2626
*/
27-
27+
#include <linux/compat.h>
2828
#include <linux/export.h>
2929
#include <linux/debugfs.h>
3030
#include <linux/sched/signal.h>
@@ -909,6 +909,13 @@ static int rfcomm_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned lon
909909
return err;
910910
}
911911

912+
#ifdef CONFIG_COMPAT
913+
static int rfcomm_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
914+
{
915+
return rfcomm_sock_ioctl(sock, cmd, (unsigned long)compat_ptr(arg));
916+
}
917+
#endif
918+
912919
static int rfcomm_sock_shutdown(struct socket *sock, int how)
913920
{
914921
struct sock *sk = sock->sk;
@@ -1042,7 +1049,10 @@ static const struct proto_ops rfcomm_sock_ops = {
10421049
.gettstamp = sock_gettstamp,
10431050
.poll = bt_sock_poll,
10441051
.socketpair = sock_no_socketpair,
1045-
.mmap = sock_no_mmap
1052+
.mmap = sock_no_mmap,
1053+
#ifdef CONFIG_COMPAT
1054+
.compat_ioctl = rfcomm_sock_compat_ioctl,
1055+
#endif
10461056
};
10471057

10481058
static const struct net_proto_family rfcomm_sock_family_ops = {

0 commit comments

Comments
 (0)