~ubuntu-branches/ubuntu/karmic/linux-ec2/karmic-updates

« back to all changes in this revision

Viewing changes to net/core/ethtool.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Stefan Bader, Upstream Kernel Changes, Ubuntu: 2.6.31-22.70
  • Date: 2010-12-01 11:17:04 UTC
  • mfrom: (7.2.7 karmic-security)
  • Revision ID: james.westby@ubuntu.com-20101201111704-pt5hbhkjlzpqq66a
Tags: 2.6.31-307.23
[ Stefan Bader ]

* Rebased to 2.6.31-22.70

[ Upstream Kernel Changes ]

* xen, compat: Test %rax for the syscall number, not %eax
  - CVE-2010-3301
* xen, compat: Retruncate rax after ia32 syscall entry tracing
  - CVE-2010-3301

[ Ubuntu: 2.6.31-22.70 ]

* Revert "SAUCE: AF_ECONET saddr->cookie prevent NULL pointer
  dereference"
* Revert "SAUCE: AF_ECONET SIOCSIFADDR ioctl does not check privileges"
* Revert "SAUCE: AF_ECONET prevent kernel stack overflow"
* Btrfs: fix checks in BTRFS_IOC_CLONE_RANGE
  - CVE-2010-2538
* xfs: validate untrusted inode numbers during lookup
  - CVE-2010-2943
* xfs: rename XFS_IGET_BULKSTAT to XFS_IGET_UNTRUSTED
  - CVE-2010-2943
* xfs: remove block number from inode lookup code
  - CVE-2010-2943
* xfs: fix untrusted inode number lookup
  - CVE-2010-2943
* drm/i915: Sanity check pread/pwrite
  - CVE-2010-2962
* drm/i915: Rephrase pwrite bounds checking to avoid any potential
  overflow
  - CVE-2010-2962
* tracing: Do not allow llseek to set_ftrace_filter
  - CVE-2010-3079
* drivers/net/cxgb3/cxgb3_main.c: prevent reading uninitialized stack
  memory
  - CVE-2010-3296
* drivers/net/eql.c: prevent reading uninitialized stack memory
  - CVE-2010-3297
* drivers/net/usb/hso.c: prevent reading uninitialized memory
  - CVE-2010-3298
* setup_arg_pages: diagnose excessive argument size
  - CVE-2010-3858
* net: clear heap allocation for ETHTOOL_GRXCLSRLALL
  - CVE-2010-3861
* ipc: shm: fix information leak to userland
  - CVE-2010-4072
* econet: disallow NULL remote addr for sendmsg(), fixes CVE-2010-3849
  - CVE-2010-3849
* econet: fix CVE-2010-3850
  - CVE-2010-3850
* econet: fix CVE-2010-3848
  - CVE-2010-3848

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        return 0;
210
210
}
211
211
 
212
 
static int ethtool_set_rxnfc(struct net_device *dev, void __user *useraddr)
 
212
static int ethtool_set_rxnfc(struct net_device *dev, u32 cmd,
 
213
                             void __user *useraddr)
213
214
{
214
 
        struct ethtool_rxnfc cmd;
 
215
        struct ethtool_rxnfc info;
 
216
        size_t info_size = sizeof(info);
215
217
 
216
218
        if (!dev->ethtool_ops->set_rxnfc)
217
219
                return -EOPNOTSUPP;
218
220
 
219
 
        if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
 
221
        /* struct ethtool_rxnfc was originally defined for
 
222
         * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
 
223
         * members.  User-space might still be using that
 
224
         * definition. */
 
225
        if (cmd == ETHTOOL_SRXFH)
 
226
                info_size = (offsetof(struct ethtool_rxnfc, data) +
 
227
                             sizeof(info.data));
 
228
 
 
229
        if (copy_from_user(&info, useraddr, info_size))
220
230
                return -EFAULT;
221
231
 
222
 
        return dev->ethtool_ops->set_rxnfc(dev, &cmd);
 
232
        return dev->ethtool_ops->set_rxnfc(dev, &info);
223
233
}
224
234
 
225
 
static int ethtool_get_rxnfc(struct net_device *dev, void __user *useraddr)
 
235
static int ethtool_get_rxnfc(struct net_device *dev, u32 cmd,
 
236
                             void __user *useraddr)
226
237
{
227
238
        struct ethtool_rxnfc info;
 
239
        size_t info_size = sizeof(info);
228
240
        const struct ethtool_ops *ops = dev->ethtool_ops;
229
241
        int ret;
230
242
        void *rule_buf = NULL;
232
244
        if (!ops->get_rxnfc)
233
245
                return -EOPNOTSUPP;
234
246
 
235
 
        if (copy_from_user(&info, useraddr, sizeof(info)))
 
247
        /* struct ethtool_rxnfc was originally defined for
 
248
         * ETHTOOL_{G,S}RXFH with only the cmd, flow_type and data
 
249
         * members.  User-space might still be using that
 
250
         * definition. */
 
251
        if (cmd == ETHTOOL_GRXFH)
 
252
                info_size = (offsetof(struct ethtool_rxnfc, data) +
 
253
                             sizeof(info.data));
 
254
 
 
255
        if (copy_from_user(&info, useraddr, info_size))
236
256
                return -EFAULT;
237
257
 
238
258
        if (info.cmd == ETHTOOL_GRXCLSRLALL) {
239
259
                if (info.rule_cnt > 0) {
240
 
                        rule_buf = kmalloc(info.rule_cnt * sizeof(u32),
 
260
                        rule_buf = kzalloc(info.rule_cnt * sizeof(u32),
241
261
                                           GFP_USER);
242
262
                        if (!rule_buf)
243
263
                                return -ENOMEM;
249
269
                goto err_out;
250
270
 
251
271
        ret = -EFAULT;
252
 
        if (copy_to_user(useraddr, &info, sizeof(info)))
 
272
        if (copy_to_user(useraddr, &info, info_size))
253
273
                goto err_out;
254
274
 
255
275
        if (rule_buf) {
1087
1107
        case ETHTOOL_GRXCLSRLCNT:
1088
1108
        case ETHTOOL_GRXCLSRULE:
1089
1109
        case ETHTOOL_GRXCLSRLALL:
1090
 
                rc = ethtool_get_rxnfc(dev, useraddr);
 
1110
                rc = ethtool_get_rxnfc(dev, ethcmd, useraddr);
1091
1111
                break;
1092
1112
        case ETHTOOL_SRXFH:
1093
1113
        case ETHTOOL_SRXCLSRLDEL:
1094
1114
        case ETHTOOL_SRXCLSRLINS:
1095
 
                rc = ethtool_set_rxnfc(dev, useraddr);
 
1115
                rc = ethtool_set_rxnfc(dev, ethcmd, useraddr);
1096
1116
                break;
1097
1117
        case ETHTOOL_GGRO:
1098
1118
                rc = ethtool_get_gro(dev, useraddr);