Skip to content

Commit fa998ba

Browse files
Christoph HellwigSherryYang1
authored andcommitted
net/atm: remove the atmdev_ops {get, set}sockopt methods
[ Upstream commit a06d30a ] All implementations of these two methods are dummies that always return -EINVAL. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: David S. Miller <[email protected]> Stable-dep-of: ec79003c5f9d ("atm: atmtcp: Prevent arbitrary write in atmtcp_recv_control().") Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit da965f751a8f9f55e4629f988f000bbf637289dc) Signed-off-by: Sherry Yang <[email protected]>
1 parent 2c93d14 commit fa998ba

File tree

10 files changed

+2
-143
lines changed

10 files changed

+2
-143
lines changed

drivers/atm/eni.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,21 +2035,6 @@ static int eni_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
20352035
return dev->phy->ioctl(dev,cmd,arg);
20362036
}
20372037

2038-
2039-
static int eni_getsockopt(struct atm_vcc *vcc,int level,int optname,
2040-
void __user *optval,int optlen)
2041-
{
2042-
return -EINVAL;
2043-
}
2044-
2045-
2046-
static int eni_setsockopt(struct atm_vcc *vcc,int level,int optname,
2047-
void __user *optval,unsigned int optlen)
2048-
{
2049-
return -EINVAL;
2050-
}
2051-
2052-
20532038
static int eni_send(struct atm_vcc *vcc,struct sk_buff *skb)
20542039
{
20552040
enum enq_res res;
@@ -2223,8 +2208,6 @@ static const struct atmdev_ops ops = {
22232208
.open = eni_open,
22242209
.close = eni_close,
22252210
.ioctl = eni_ioctl,
2226-
.getsockopt = eni_getsockopt,
2227-
.setsockopt = eni_setsockopt,
22282211
.send = eni_send,
22292212
.phy_put = eni_phy_put,
22302213
.phy_get = eni_phy_get,

drivers/atm/firestream.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,6 @@ static const struct atmdev_ops ops = {
12781278
.send = fs_send,
12791279
.owner = THIS_MODULE,
12801280
/* ioctl: fs_ioctl, */
1281-
/* getsockopt: fs_getsockopt, */
1282-
/* setsockopt: fs_setsockopt, */
12831281
/* change_qos: fs_change_qos, */
12841282

12851283
/* For now implement these internally here... */

drivers/atm/fore200e.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,31 +1710,6 @@ fore200e_getstats(struct fore200e* fore200e)
17101710
return 0;
17111711
}
17121712

1713-
1714-
static int
1715-
fore200e_getsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, int optlen)
1716-
{
1717-
/* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */
1718-
1719-
DPRINTK(2, "getsockopt %d.%d.%d, level = %d, optname = 0x%x, optval = 0x%p, optlen = %d\n",
1720-
vcc->itf, vcc->vpi, vcc->vci, level, optname, optval, optlen);
1721-
1722-
return -EINVAL;
1723-
}
1724-
1725-
1726-
static int
1727-
fore200e_setsockopt(struct atm_vcc* vcc, int level, int optname, void __user *optval, unsigned int optlen)
1728-
{
1729-
/* struct fore200e* fore200e = FORE200E_DEV(vcc->dev); */
1730-
1731-
DPRINTK(2, "setsockopt %d.%d.%d, level = %d, optname = 0x%x, optval = 0x%p, optlen = %d\n",
1732-
vcc->itf, vcc->vpi, vcc->vci, level, optname, optval, optlen);
1733-
1734-
return -EINVAL;
1735-
}
1736-
1737-
17381713
#if 0 /* currently unused */
17391714
static int
17401715
fore200e_get_oc3(struct fore200e* fore200e, struct oc3_regs* regs)
@@ -3026,8 +3001,6 @@ static const struct atmdev_ops fore200e_ops = {
30263001
.open = fore200e_open,
30273002
.close = fore200e_close,
30283003
.ioctl = fore200e_ioctl,
3029-
.getsockopt = fore200e_getsockopt,
3030-
.setsockopt = fore200e_setsockopt,
30313004
.send = fore200e_send,
30323005
.change_qos = fore200e_change_qos,
30333006
.proc_read = fore200e_proc_read,

drivers/atm/horizon.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,46 +2527,6 @@ static void hrz_close (struct atm_vcc * atm_vcc) {
25272527
clear_bit(ATM_VF_ADDR,&atm_vcc->flags);
25282528
}
25292529

2530-
#if 0
2531-
static int hrz_getsockopt (struct atm_vcc * atm_vcc, int level, int optname,
2532-
void *optval, int optlen) {
2533-
hrz_dev * dev = HRZ_DEV(atm_vcc->dev);
2534-
PRINTD (DBG_FLOW|DBG_VCC, "hrz_getsockopt");
2535-
switch (level) {
2536-
case SOL_SOCKET:
2537-
switch (optname) {
2538-
// case SO_BCTXOPT:
2539-
// break;
2540-
// case SO_BCRXOPT:
2541-
// break;
2542-
default:
2543-
return -ENOPROTOOPT;
2544-
};
2545-
break;
2546-
}
2547-
return -EINVAL;
2548-
}
2549-
2550-
static int hrz_setsockopt (struct atm_vcc * atm_vcc, int level, int optname,
2551-
void *optval, unsigned int optlen) {
2552-
hrz_dev * dev = HRZ_DEV(atm_vcc->dev);
2553-
PRINTD (DBG_FLOW|DBG_VCC, "hrz_setsockopt");
2554-
switch (level) {
2555-
case SOL_SOCKET:
2556-
switch (optname) {
2557-
// case SO_BCTXOPT:
2558-
// break;
2559-
// case SO_BCRXOPT:
2560-
// break;
2561-
default:
2562-
return -ENOPROTOOPT;
2563-
};
2564-
break;
2565-
}
2566-
return -EINVAL;
2567-
}
2568-
#endif
2569-
25702530
#if 0
25712531
static int hrz_ioctl (struct atm_dev * atm_dev, unsigned int cmd, void *arg) {
25722532
hrz_dev * dev = HRZ_DEV(atm_dev);

drivers/atm/iphase.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,20 +2882,6 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
28822882
return 0;
28832883
}
28842884

2885-
static int ia_getsockopt(struct atm_vcc *vcc, int level, int optname,
2886-
void __user *optval, int optlen)
2887-
{
2888-
IF_EVENT(printk(">ia_getsockopt\n");)
2889-
return -EINVAL;
2890-
}
2891-
2892-
static int ia_setsockopt(struct atm_vcc *vcc, int level, int optname,
2893-
void __user *optval, unsigned int optlen)
2894-
{
2895-
IF_EVENT(printk(">ia_setsockopt\n");)
2896-
return -EINVAL;
2897-
}
2898-
28992885
static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
29002886
IADEV *iadev;
29012887
struct dle *wr_ptr;
@@ -3166,8 +3152,6 @@ static const struct atmdev_ops ops = {
31663152
.open = ia_open,
31673153
.close = ia_close,
31683154
.ioctl = ia_ioctl,
3169-
.getsockopt = ia_getsockopt,
3170-
.setsockopt = ia_setsockopt,
31713155
.send = ia_send,
31723156
.phy_put = ia_phy_put,
31733157
.phy_get = ia_phy_get,

drivers/atm/lanai.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,8 +2540,6 @@ static const struct atmdev_ops ops = {
25402540
.dev_close = lanai_dev_close,
25412541
.open = lanai_open,
25422542
.close = lanai_close,
2543-
.getsockopt = NULL,
2544-
.setsockopt = NULL,
25452543
.send = lanai_send,
25462544
.phy_put = NULL,
25472545
.phy_get = NULL,

drivers/atm/solos-pci.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,8 +1179,6 @@ static const struct atmdev_ops fpga_ops = {
11791179
.open = popen,
11801180
.close = pclose,
11811181
.ioctl = NULL,
1182-
.getsockopt = NULL,
1183-
.setsockopt = NULL,
11841182
.send = psend,
11851183
.send_oam = NULL,
11861184
.phy_put = NULL,

drivers/atm/zatm.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,20 +1515,6 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
15151515
}
15161516
}
15171517

1518-
1519-
static int zatm_getsockopt(struct atm_vcc *vcc,int level,int optname,
1520-
void __user *optval,int optlen)
1521-
{
1522-
return -EINVAL;
1523-
}
1524-
1525-
1526-
static int zatm_setsockopt(struct atm_vcc *vcc,int level,int optname,
1527-
void __user *optval,unsigned int optlen)
1528-
{
1529-
return -EINVAL;
1530-
}
1531-
15321518
static int zatm_send(struct atm_vcc *vcc,struct sk_buff *skb)
15331519
{
15341520
int error;
@@ -1582,8 +1568,6 @@ static const struct atmdev_ops ops = {
15821568
.open = zatm_open,
15831569
.close = zatm_close,
15841570
.ioctl = zatm_ioctl,
1585-
.getsockopt = zatm_getsockopt,
1586-
.setsockopt = zatm_setsockopt,
15871571
.send = zatm_send,
15881572
.phy_put = zatm_phy_put,
15891573
.phy_get = zatm_phy_get,

include/linux/atmdev.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,6 @@ struct atm_dev {
176176
#define ATM_OF_IMMED 1 /* Attempt immediate delivery */
177177
#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */
178178

179-
180-
/*
181-
* ioctl, getsockopt, and setsockopt are optional and can be set to NULL.
182-
*/
183-
184179
struct atmdev_ops { /* only send is required */
185180
void (*dev_close)(struct atm_dev *dev);
186181
int (*open)(struct atm_vcc *vcc);
@@ -190,10 +185,6 @@ struct atmdev_ops { /* only send is required */
190185
int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
191186
void __user *arg);
192187
#endif
193-
int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
194-
void __user *optval,int optlen);
195-
int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
196-
void __user *optval,unsigned int optlen);
197188
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
198189
int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
199190
void (*phy_put)(struct atm_dev *dev,unsigned char value,

net/atm/common.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -783,13 +783,8 @@ int vcc_setsockopt(struct socket *sock, int level, int optname,
783783
vcc->atm_options &= ~ATM_ATMOPT_CLP;
784784
return 0;
785785
default:
786-
if (level == SOL_SOCKET)
787-
return -EINVAL;
788-
break;
789-
}
790-
if (!vcc->dev || !vcc->dev->ops->setsockopt)
791786
return -EINVAL;
792-
return vcc->dev->ops->setsockopt(vcc, level, optname, optval, optlen);
787+
}
793788
}
794789

795790
int vcc_getsockopt(struct socket *sock, int level, int optname,
@@ -827,13 +822,8 @@ int vcc_getsockopt(struct socket *sock, int level, int optname,
827822
return copy_to_user(optval, &pvc, sizeof(pvc)) ? -EFAULT : 0;
828823
}
829824
default:
830-
if (level == SOL_SOCKET)
831-
return -EINVAL;
832-
break;
833-
}
834-
if (!vcc->dev || !vcc->dev->ops->getsockopt)
835825
return -EINVAL;
836-
return vcc->dev->ops->getsockopt(vcc, level, optname, optval, len);
826+
}
837827
}
838828

839829
int register_atmdevice_notifier(struct notifier_block *nb)

0 commit comments

Comments
 (0)